fixed WML parser bug
This commit is contained in:
parent
8a3e61754c
commit
2c68c8304c
2 changed files with 10 additions and 3 deletions
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue