Use prefix instead of postfix increment/decrement
Found by cppcheck.
This commit is contained in:
parent
83fad13973
commit
bf83aecd08
1 changed files with 6 additions and 4 deletions
|
@ -92,24 +92,26 @@ bool playturn_network_adapter::read(config& dst)
|
|||
assert(next_->cfg.all_children_count() > next_command_num_);
|
||||
config::all_children_iterator itor = child_old.ordered_begin();
|
||||
//TODO: implement operator + (all_children_iterator, int ) properly
|
||||
for(unsigned int i = 0; i < next_command_num_; i++) {itor++;}
|
||||
for(unsigned int i = 0; i < next_command_num_; ++i) {
|
||||
++itor;
|
||||
}
|
||||
//TODO: implement a non const version of ordered children
|
||||
config& childchild_old = const_cast<config&>(itor->cfg);
|
||||
config& childchild = child.add_child(itor->key);
|
||||
childchild.swap(childchild_old);
|
||||
|
||||
next_command_num_++;
|
||||
++next_command_num_;
|
||||
if(next_->cfg.all_children_count() == next_command_num_)
|
||||
{
|
||||
next_command_num_ = 0;
|
||||
next_++;
|
||||
++next_;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
child.swap(child_old);
|
||||
next_++;
|
||||
++next_;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue