mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 20:02:31 +00:00
add a note and new variable name to better indicate the risk...
...of WML event invalidating iterator. also fix indentation.
This commit is contained in:
parent
0c89bc2c32
commit
3f642a770f
@ -2266,19 +2266,21 @@ size_t move_unit(move_unit_spectator *move_spectator,
|
||||
|
||||
event_mutated |= game_events::pump();
|
||||
|
||||
ui = units.find(steps.back());
|
||||
//NOTE: an wml event may have removed the unit pointed by ui
|
||||
unit_map::iterator maybe_ui = units.find(steps.back());
|
||||
|
||||
if (move_spectator!=NULL) {
|
||||
move_spectator->set_unit(ui);
|
||||
move_spectator->set_unit(maybe_ui);
|
||||
}
|
||||
|
||||
if(undo_stack != NULL) {
|
||||
if(event_mutated || should_clear_stack || ui == units.end()) {
|
||||
if(event_mutated || should_clear_stack || maybe_ui == units.end()) {
|
||||
apply_shroud_changes(*undo_stack, team_num + 1);
|
||||
undo_stack->clear();
|
||||
} else {
|
||||
// MP_COUNTDOWN: added param
|
||||
undo_stack->push_back(
|
||||
undo_action(ui->second, steps,
|
||||
undo_action(maybe_ui->second, steps,
|
||||
starting_waypoints, starting_moves,
|
||||
action_time_bonus, orig_village_owner, orig_dir));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user