loadgame: replaced individual flag getters with data struct getter

This commit is contained in:
Charles Dang 2016-09-08 12:37:43 +11:00
parent 84de6bafb1
commit 6aee108298
4 changed files with 11 additions and 10 deletions

View file

@ -333,7 +333,7 @@ void create::process_event_impl(const process_event_data & data)
}
}
if (load.cancel_orders())
if (load.data().cancel_orders)
engine_.get_state().cancel_orders();
engine_.prepare_for_saved_game();

View file

@ -677,14 +677,14 @@ bool game_launcher::load_game()
return false;
}
play_replay_ = load.show_replay();
play_replay_ = load.data().show_replay;
LOG_CONFIG << "is middle game savefile: " << (state_.is_mid_game_save() ? "yes" : "no") << "\n";
LOG_CONFIG << "show replay: " << (play_replay_ ? "yes" : "no") << "\n";
// in case load.show_replay() && !state_.is_mid_game_save()
// in case load.data().show_replay && !state_.is_mid_game_save()
// there won't be any turns to replay, but the
// user gets to watch the intro sequence again ...
if(state_.is_mid_game_save() && load.show_replay())
if(state_.is_mid_game_save() && load.data().show_replay)
{
statistics::clear_current_scenario();
}
@ -693,7 +693,7 @@ bool game_launcher::load_game()
state_.unify_controllers();
}
if (load.cancel_orders()) {
if (load.data().cancel_orders) {
state_.cancel_orders();
}

View file

@ -562,7 +562,7 @@ void tmp_create_game::load_game_callback(twindow& window)
return ;
}
if(load.cancel_orders()) {
if(load.data().cancel_orders) {
create_engine_.get_state().cancel_orders();
}

View file

@ -81,10 +81,11 @@ public:
void set_gamestate();
// Getter-methods
bool show_replay() const { return load_data_.show_replay; }
bool cancel_orders() const { return load_data_.cancel_orders; }
const std::string & filename() const { return load_data_.filename; }
const load_game_metadata& data()
{
return load_data_;
}
/** GUI Dialog sequence which confirms attempts to load saves from previous game versions. */
static bool check_version_compatibility(const version_info & version, CVideo & video);