diff --git a/src/menu_events.cpp b/src/menu_events.cpp index 7515ee78806d..398154499813 100644 --- a/src/menu_events.cpp +++ b/src/menu_events.cpp @@ -138,10 +138,7 @@ void menu_handler::objectives() return; } - config cfg; - cfg["side"] = gui_->viewing_side(); - gamestate().lua_kernel_->run_wml_action("show_objectives", vconfig(cfg), - game_events::queued_event("_from_interface", "", map_location(), map_location(), config())); + pc_.refresh_objectives(); pc_.show_objectives(); } diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 1050f2dc7432..5156346eed97 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -388,6 +388,13 @@ void play_controller::fire_prestart() gamestate().gamedata_.get_variable("turn_number") = static_cast(turn()); } +void play_controller::refresh_objectives() const +{ + const config cfg("side", gui_->viewing_side()); + gamestate().lua_kernel_->run_wml_action("show_objectives", vconfig(cfg), + game_events::queued_event("_from_interface", "", map_location(), map_location(), config())); +} + void play_controller::fire_start() { gamestate().gamedata_.set_phase(game_data::START); @@ -396,6 +403,7 @@ void play_controller::fire_start() // start event may modify start turn with WML, reflect any changes. gamestate().gamedata_.get_variable("turn_number") = static_cast(turn()); + refresh_objectives(); check_objectives(); // prestart and start events may modify the initial gold amount, reflect any changes. diff --git a/src/play_controller.hpp b/src/play_controller.hpp index 651556a45f72..3738e6517a26 100644 --- a/src/play_controller.hpp +++ b/src/play_controller.hpp @@ -361,6 +361,8 @@ class play_controller : public controller_base, public events::observer, public return false; } + /// Reevaluate [show_if] conditions and build a new objectives string. + void refresh_objectives() const; void show_objectives() const; struct scoped_savegame_snapshot