Whiteboard/side_actions: rewrote a method...
...to avoid doing something really wrong with iterators.
This commit is contained in:
parent
c43f121557
commit
081fb8fcad
1 changed files with 4 additions and 3 deletions
|
@ -420,13 +420,14 @@ side_actions::iterator side_actions::find_last_action_of(unit const* unit, side_
|
|||
{
|
||||
if (!empty() && validate_iterator(start_position))
|
||||
{
|
||||
side_actions::iterator position;
|
||||
for (position = start_position; position != begin() - 1; --position)
|
||||
reverse_iterator position(start_position);
|
||||
for (--position ; position != rend(); ++position)
|
||||
{
|
||||
action_ptr action = *position;
|
||||
if (action->get_unit() == unit)
|
||||
{
|
||||
return position;
|
||||
iterator found_position = position.base();
|
||||
return --found_position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue