replace playsingle_controller::do_autosaves_

This commit is contained in:
gfgtdf 2015-03-27 18:04:17 +01:00
parent 17afc39e8a
commit 5911ee1950
4 changed files with 5 additions and 8 deletions

View file

@ -142,6 +142,7 @@ play_controller::play_controller(const config& level, saved_game& state_of_game,
, linger_(false)
, it_is_a_new_turn_(level["it_is_a_new_turn"].to_bool(true))
, init_side_done_(level["init_side_done"].to_bool(false))
, init_side_done_now_(false)
, ticks_(ticks)
, victory_when_enemies_defeated_(level["victory_when_enemies_defeated"].to_bool(true))
, remove_from_carryover_on_defeat_(level["remove_from_carryover_on_defeat"].to_bool(true))
@ -381,6 +382,7 @@ void play_controller::do_init_side()
//In case we might end up calling sync:network during the side turn events,
//and we don't want do_init_side to be called when a player drops.
init_side_done_ = true;
init_side_done_now_ = true;
const std::string turn_num = str_cast(turn());
const std::string side_num = str_cast(player_number_);

View file

@ -282,9 +282,9 @@ protected:
bool linger_;
bool it_is_a_new_turn_;
bool init_side_done_;
/// whether we did init side in this session ( false = we did init side before we reloaded the game).
bool init_side_done_now_;
const int ticks_;
const std::string& select_victory_music() const;
const std::string& select_defeat_music() const;
void set_victory_music_list(const std::string& list);

View file

@ -83,7 +83,6 @@ playsingle_controller::playsingle_controller(const config& level,
, end_turn_(END_TURN_NONE)
, player_type_changed_(false)
, skip_next_turn_(false)
, do_autosaves_(false)
{
hotkey_handler_.reset(new hotkey_handler(*this, saved_game_)); //upgrade hotkey handler to the sp (whiteboard enabled) version
@ -266,7 +265,6 @@ void playsingle_controller::play_scenario_main_loop() {
// Avoid autosaving after loading, but still
// allow the first turn to have an autosave.
do_autosaves_ = !loading_game_;
ai_testing::log_game_start();
if(gamestate_.board_.teams().empty())
{
@ -277,8 +275,6 @@ void playsingle_controller::play_scenario_main_loop() {
if (is_regular_game_end()) {
return;
}
do_autosaves_ = true;
} //end for loop
}
@ -577,7 +573,7 @@ void playsingle_controller::before_human_turn()
//TODO: why do we need the next line?
ai::manager::raise_turn_started();
if(do_autosaves_ && !is_regular_game_end()) {
if(init_side_done_now_ && !is_regular_game_end()) {
update_savegame_snapshot();
savegame::autosave_savegame save(saved_game_, *gui_, preferences::save_compression_format());
save.autosave(game_config::disable_autosave, preferences::autosavemax(), preferences::INFINITE_AUTO_SAVES);

View file

@ -91,7 +91,6 @@ protected:
END_TURN_STATE end_turn_;
bool player_type_changed_;
bool skip_next_turn_;
bool do_autosaves_;
void linger();
void sync_end_turn();
};