Skip to content

Commit

Permalink
implement pre_advance event
Browse files Browse the repository at this point in the history
pre advance event fires before the user sees the advancement dialog.
Implements fr https://gna.org/bugs/?21464
  • Loading branch information
gfgtdf committed Aug 3, 2014
1 parent ede5148 commit a5e77c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/actions/attack.cpp
Expand Up @@ -1459,6 +1459,18 @@ void advance_unit_at(const advance_unit_params& params)
return;
}

if(params.fire_events_)
{
LOG_NG << "Firing pre_advance event at " << params.loc_ <<".\n";
game_events::fire("pre_advance", params.loc_);
//TODO: maybe use id instead of location here ?.
u = resources::units->find(params.loc_);
if(!unit_helper::will_certainly_advance(u))
{
LOG_NG << "pre_advance event aborted advancing.\n";
return;
}
}
//we don't want to let side 1 decide it during start/prestart.
int side_for = resources::gamedata->phase() == game_data::PLAY ? 0: u->side();
config selected = mp_sync::get_user_choice("choose",
Expand Down

0 comments on commit a5e77c0

Please sign in to comment.