Also fix #2852 when using "Back to turn" in a networked MP game.
This commit is contained in:
parent
d3c1cc43e7
commit
301aa1da79
3 changed files with 10 additions and 5 deletions
|
@ -313,7 +313,8 @@ void playsingle_controller::hotkey_handler::load_autosave(const std::string& fil
|
|||
return;
|
||||
}
|
||||
std::shared_ptr<config> res(new config(savegame.child_or_empty("snapshot")));
|
||||
throw reset_gamestate_exception(res, true);
|
||||
std::shared_ptr<config> stats(new config(savegame.child_or_empty("statistics")));
|
||||
throw reset_gamestate_exception(res, stats, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -203,8 +203,11 @@ void playsingle_controller::play_scenario_main_loop()
|
|||
for(std::size_t i = 0; i < local_players.size(); ++i) {
|
||||
local_players[i] = gamestate().board_.teams()[i].is_local();
|
||||
}
|
||||
if(!ex.start_replay) {
|
||||
// TODO: is this also needed when start_replay is true?
|
||||
if(ex.start_replay) {
|
||||
// MP "Back to turn"
|
||||
statistics::read_stats(*ex.stats_);
|
||||
} else {
|
||||
// SP replay
|
||||
statistics::reset_current_scenario();
|
||||
}
|
||||
reset_gamestate(*ex.level, (*ex.level)["replay_pos"]);
|
||||
|
@ -671,7 +674,7 @@ void playsingle_controller::reset_replay()
|
|||
{
|
||||
if(replay_controller_ && replay_controller_->allow_reset_replay()) {
|
||||
replay_controller_->stop_replay();
|
||||
throw reset_gamestate_exception(replay_controller_->get_reset_state(), false);
|
||||
throw reset_gamestate_exception(replay_controller_->get_reset_state(), {}, false);
|
||||
}
|
||||
else {
|
||||
ERR_NG << "received invalid reset replay\n";
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
|
||||
struct reset_gamestate_exception : public std::exception
|
||||
{
|
||||
reset_gamestate_exception(std::shared_ptr<config> l, bool s = true) : level(l), start_replay(s) {}
|
||||
reset_gamestate_exception(std::shared_ptr<config> l, std::shared_ptr<config> stats, bool s = true) : level(l), stats_(stats), start_replay(s) {}
|
||||
std::shared_ptr<config> level;
|
||||
std::shared_ptr<config> stats_;
|
||||
bool start_replay;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue