From 03254fdb1e0b6620863072edc93e3fedf634bd02 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Sat, 31 May 2014 20:43:30 -0400 Subject: [PATCH] use completion setter object in mp linger mode mp linger mode was not properly setting the completion status, as sp does. This caused mp end of scenario saves not to end up in linger mode when they are reloaded. Note that this reopens bug 15545 (!) https://gna.org/bugs/index.php?15545 In 1.11+, I believe that the correct way to fix that is to save the [carryover] while in linger mode, and restore it on reload, however this is for another commit... --- src/playmp_controller.cpp | 2 +- src/playsingle_controller.cpp | 14 -------------- src/playsingle_controller.hpp | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/playmp_controller.cpp b/src/playmp_controller.cpp index 0c85344c401c..a71e25d6201f 100644 --- a/src/playmp_controller.cpp +++ b/src/playmp_controller.cpp @@ -311,7 +311,7 @@ void playmp_controller::linger() // this is actually for after linger mode is over -- we don't want to // stay stuck in linger state when the *next* scenario is over. - gamestate_.classification().completion = "running"; + set_completion setter(gamestate_,"running"); // End all unit moves BOOST_FOREACH(unit &u, units_) { u.set_user_end_turn(true); diff --git a/src/playsingle_controller.cpp b/src/playsingle_controller.cpp index 10acc669604b..ed9223255850 100644 --- a/src/playsingle_controller.cpp +++ b/src/playsingle_controller.cpp @@ -811,20 +811,6 @@ void playsingle_controller::play_human_turn() { gui_->draw(); } } -struct set_completion -{ - set_completion(game_state& state, const std::string& completion) : - state_(state), completion_(completion) - { - } - ~set_completion() - { - state_.classification().completion = completion_; - } - private: - game_state& state_; - const std::string completion_; -}; void playsingle_controller::linger() { diff --git a/src/playsingle_controller.hpp b/src/playsingle_controller.hpp index 09df87f006e4..573c8b9bb3ae 100644 --- a/src/playsingle_controller.hpp +++ b/src/playsingle_controller.hpp @@ -21,6 +21,21 @@ #include "playturn.hpp" #include "replay.hpp" +struct set_completion +{ + set_completion(game_state& state, const std::string& completion) : + state_(state), completion_(completion) + { + } + ~set_completion() + { + state_.classification().completion = completion_; + } + private: + game_state& state_; + const std::string completion_; +}; + class playsingle_controller : public play_controller { public: