this fixes a crash in the recall event_handler

-note, there is still a bug that allows first_time_only events to
 re-trigger themselves, but at least it won't crash now.
 (http://www.wesnoth.org/forum/viewtopic.php?p=201439)
This commit is contained in:
Patrick Parker 2006-12-14 02:18:25 +00:00
parent 1f19145c1a
commit b5b526950e

View file

@ -1210,8 +1210,9 @@ bool event_handler::handle_event_command(const queued_event& event_info,
u->set_game_context(game_data_ptr,units,game_map,status_ptr,teams);
if(game_events::unit_matches_filter(*u, cfg,gamemap::location())) {
gamemap::location loc = cfg_to_loc(cfg);
recruit_unit(*game_map,index+1,*units,*u,loc,utils::string_bool(cfg["show"],true) ? NULL : screen,false,true);
avail.erase(u);
unit to_recruit(*u);
avail.erase(u); //erase before recruiting, since recruiting can fire more events
recruit_unit(*game_map,index+1,*units,to_recruit,loc,utils::string_bool(cfg["show"],true) ? NULL : screen,false,true);
unit_recalled = true;
break;
}