fix #1492 replays not saved in campaigns

previously the clint woudl send a [update_game] to the
server before sending [store_next_scenario] whcih set
game::started_ to false and this disabled game::save_replay()

Now we instead set started_ to false after save_replay() is called

I also don't really see the point of calling update_side_data()
and describe_slots() before the new level data is available so i just
removed these calls. (the call to game::update_game())
This commit is contained in:
gfgtdf 2019-08-26 22:42:18 +02:00
parent b14a4b1bb3
commit c4ffade49a
3 changed files with 3 additions and 6 deletions

View file

@ -792,7 +792,6 @@ void connect_engine::send_level_data() const
});
send_to_server(level_);
} else {
send_to_server(config {"update_game", config()});
config next_level;
next_level.add_child("store_next_scenario", level_);
send_to_server(next_level);

View file

@ -1616,6 +1616,7 @@ void game::new_scenario(const socket_ptr& sender)
players_not_advanced_.insert(user_ptr);
}
}
started_ = false;
}
void game::load_next_scenario(const socket_ptr& user)

View file

@ -1538,8 +1538,9 @@ void server::handle_player_in_game(socket_ptr socket, std::shared_ptr<simple_wml
return;
}
g.new_scenario(socket);
g.save_replay();
g.new_scenario(socket);
g.reset_last_synced_context_id();
// Record the full scenario in g.level()
@ -1631,10 +1632,6 @@ void server::handle_player_in_game(socket_ptr socket, std::shared_ptr<simple_wml
// update the game having changed in the lobby
update_game_in_lobby(g);
return;
} else if(data.child("update_game")) {
g.update_game();
update_game_in_lobby(g);
return;
} else if(data.child("leave_game")) {
if(g.remove_player(socket)) {
delete_game(g.id());