Follow-up Comment #4, bug #13256 (project wesnoth):
The problematic code fragments are:
src/actions.cpp:2413
---
event_mutated |= game_events::pump();
ui = units.find(steps.back());
if(undo_stack != NULL) {
if(event_mutated || should_clear_stack || ui == units.end())
apply_shroud_changes(*undo_stack,disp,map,units,teams,team_num);
undo_stack->clear();
} else {
---
and see src/game_events.cpp:2156
---
if (fire_event)
{
game_events::fire("die", death_loc, death_loc);
un = units->find(death_loc);
if(un != units->end() && death_loc.matches_unit(un->second)){
units->erase(un);
unit_mutations++;
}
}
---
Because of the previous movement, undo_stack includes a 'undo' item with a
unit FOO. There is a WML event to kill a unit that steps on a specified hex.
Combination of those factors leads to assertion failure. Here's how:
1. the unit steps on that hex.
2. game_events::pump() pumps a WML event to kill unit FOO. (see
src/game_events.cpp:2156 ). so, FOO is removed from 'units'.
3. as ui == units.end(), apply_shroud_changes(.....) is called.
4. apply_shroud_changes tries to do 'run through the list of undo_actions,
for each location along the route, clear any "shrouded" hexes that the unit
can see and record sighted events'
5. apply_shroud_changes finds the shroud action with the unit FOO. It tries
to find unit FOO in the list of units. of course, it fails, as FOO was
already deleted.
6. assert(unit_itor != units.end()); fails - assertion failure.
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?13256>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs