Skip to content

Commit

Permalink
added diagnostics to simple_wml
Browse files Browse the repository at this point in the history
  • Loading branch information
davewx7 committed Jan 15, 2009
1 parent 6b714ac commit 183d555
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server/simple_wml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,24 +408,29 @@ void node::insert_ordered_child(int child_map_index, int child_list_index)

void node::remove_ordered_child(int child_map_index, int child_list_index)
{
int erase_count = 0;
std::vector<node_pos>::iterator i = ordered_children_.begin();
while(i != ordered_children_.end()) {
if(i->child_map_index == child_map_index && i->child_list_index == child_list_index) {
i = ordered_children_.erase(i);
++erase_count;
} else {
if(i->child_map_index == child_map_index && i->child_list_index > child_list_index) {
i->child_list_index--;
}
++i;
}
}

assert(erase_count == 1);
}

void node::remove_ordered_child_list(int child_map_index)
{
std::vector<node_pos>::iterator i = ordered_children_.begin();
while(i != ordered_children_.end()) {
if(i->child_map_index == child_map_index) {
assert(false);
i = ordered_children_.erase(i);
} else {
if(i->child_map_index > child_map_index) {
Expand Down Expand Up @@ -551,6 +556,9 @@ int node::output_size() const
}
}

if(count_children != ordered_children_.size()) {
fprintf(stderr, "count_children: %d; ordered_children: %d\n", (int)count_children, (int)ordered_children_.size());
}
assert(count_children == ordered_children_.size());

return res;
Expand Down

0 comments on commit 183d555

Please sign in to comment.