Reevaluate [show_if] conditions and delayed variable expansions before displaying objectives at start.
Fixes #3544.
This commit is contained in:
parent
cef774da36
commit
b7cb36a711
3 changed files with 11 additions and 4 deletions
|
@ -143,10 +143,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();
|
||||
}
|
||||
|
||||
|
|
|
@ -362,12 +362,20 @@ void play_controller::fire_prestart()
|
|||
gamestate().gamedata_.get_variable("turn_number") = int(turn());
|
||||
}
|
||||
|
||||
void play_controller::refresh_objectives()
|
||||
{
|
||||
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);
|
||||
pump().fire("start");
|
||||
// start event may modify start turn with WML, reflect any changes.
|
||||
gamestate().gamedata_.get_variable("turn_number") = int(turn());
|
||||
refresh_objectives();
|
||||
check_objectives();
|
||||
// prestart and start events may modify the initial gold amount,
|
||||
// reflect any changes.
|
||||
|
|
|
@ -265,6 +265,8 @@ public:
|
|||
virtual bool is_networked_mp() const { return false; }
|
||||
virtual void send_to_wesnothd(const config&, const std::string& = "unknown") const { }
|
||||
virtual bool receive_from_wesnothd(config&) const { return false; }
|
||||
/// Reevaluate [show_if] conditions and build a new objectives string.
|
||||
void refresh_objectives();
|
||||
void show_objectives() const;
|
||||
struct scoped_savegame_snapshot
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue