Skip to content

Commit

Permalink
use completion setter object in mp linger mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbeck88 committed Jun 1, 2014
1 parent 4c3bc2c commit eccc67c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/playmp_controller.cpp
Expand Up @@ -342,7 +342,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);
Expand Down
14 changes: 0 additions & 14 deletions src/playsingle_controller.cpp
Expand Up @@ -803,20 +803,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()
{
Expand Down
15 changes: 15 additions & 0 deletions src/playsingle_controller.hpp
Expand Up @@ -20,6 +20,21 @@
#include "playturn_network_adapter.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:
Expand Down

0 comments on commit eccc67c

Please sign in to comment.