Skip to content

Commit

Permalink
reset 'ignore oos messages' when starting a new game
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Feb 28, 2016
1 parent f60ee0b commit efcfe3b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/play_controller.cpp
Expand Up @@ -181,6 +181,7 @@ play_controller::play_controller(const config& level, saved_game& state_of_game,
, victory_music_()
, defeat_music_()
, scope_()
, ignore_replay_errors_(false)
, player_type_changed_(false)
{
copy_persistent(level, level_);
Expand Down Expand Up @@ -1006,7 +1007,7 @@ void play_controller::process_oos(const std::string& msg) const
message << "\n\n" << _("Error details:") << "\n\n" << msg;

scoped_savegame_snapshot snapshot(*this);
savegame::oos_savegame save(saved_game_, *gui_);
savegame::oos_savegame save(saved_game_, *gui_, ignore_replay_errors_);
save.save_game_interactive(gui_->video(), message.str(), gui::YES_NO); // can throw quit_game_exception
}

Expand Down
2 changes: 1 addition & 1 deletion src/play_controller.hpp
Expand Up @@ -365,8 +365,8 @@ class play_controller : public controller_base, public events::observer, public
hotkey::scope_changer scope_;

protected:
mutable bool ignore_replay_errors_;
bool player_type_changed_;

virtual void sync_end_turn() {};
virtual void check_time_over();
virtual void update_viewing_player() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/playmp_controller.cpp
Expand Up @@ -375,7 +375,7 @@ void playmp_controller::process_oos(const std::string& err_msg) const {
temp_buf << " \n";
}
scoped_savegame_snapshot snapshot(*this);
savegame::oos_savegame save(saved_game_, *gui_);
savegame::oos_savegame save(saved_game_, *gui_, ignore_replay_errors_);
save.save_game_interactive(gui_->video(), temp_buf.str(), gui::YES_NO);
}

Expand Down
8 changes: 4 additions & 4 deletions src/savegame.cpp
Expand Up @@ -609,19 +609,19 @@ void autosave_savegame::create_filename()
set_filename(filename);
}

oos_savegame::oos_savegame(saved_game& gamestate, game_display& gui)
oos_savegame::oos_savegame(saved_game& gamestate, game_display& gui, bool& ignore)
: ingame_savegame(gamestate, gui, preferences::save_compression_format())
, ignore_(ignore)
{}

int oos_savegame::show_save_dialog(CVideo& video, const std::string& message, const gui::DIALOG_TYPE /*dialog_type*/)
{
static bool ignore_all = false;
int res = 0;

std::string filename = this->filename();

if (!ignore_all){
gui2::tgame_save_oos dlg(ignore_all, filename, title(), message);
if (!ignore_){
gui2::tgame_save_oos dlg(ignore_, filename, title(), message);
dlg.show(video);
res = dlg.get_retval();
}
Expand Down
3 changes: 2 additions & 1 deletion src/savegame.hpp
Expand Up @@ -225,11 +225,12 @@ class autosave_savegame : public ingame_savegame
class oos_savegame : public ingame_savegame
{
public:
oos_savegame(saved_game& gamestate, game_display& gui);
oos_savegame(saved_game& gamestate, game_display& gui, bool& ignore);

private:
/** Display the save game dialog. */
virtual int show_save_dialog(CVideo& video, const std::string& message, const gui::DIALOG_TYPE dialog_type);
bool& ignore_;
};

/** Class for start-of-scenario saves */
Expand Down

0 comments on commit efcfe3b

Please sign in to comment.