fixed WML parser bug

This commit is contained in:
uid68803 2004-01-13 00:02:24 +00:00
parent 8a3e61754c
commit 2c68c8304c
2 changed files with 10 additions and 3 deletions

View file

@ -544,8 +544,7 @@ namespace {
size_t config::write_size() const
{
size_t res = 0;
for(std::map<std::string,std::string>::const_iterator i = values.begin();
i != values.end(); ++i) {
for(string_map::const_iterator i = values.begin(); i != values.end(); ++i) {
if(i->second.empty() == false) {
res += i->first.size() + AttributeEquals.size() +
i->second.size() + AttributePostfix.size();
@ -699,6 +698,14 @@ void config::remove_child(const std::string& key, size_t index)
const child_pos pos(children.find(key),index);
ordered_children.erase(std::remove(ordered_children.begin(),ordered_children.end(),pos),ordered_children.end());
//decrement all indices in the ordering that are above this index, since everything
//is getting shifted back by 1.
for(std::vector<child_pos>::iterator i = ordered_children.begin(); i != ordered_children.end(); ++i) {
if(i->pos->first == key && i->index > index) {
i->index--;
}
}
//remove from the child map
child_list& v = children[key];
assert(index < v.size());

View file

@ -247,8 +247,8 @@ void server::run()
const config::child_iterator desc = std::find(vg.first,vg.second,g->description());
if(desc != vg.second) {
delete *desc;
gamelist->remove_child("game",desc - vg.first);
delete *desc;
}
//put the players back in the lobby and send