when ending a game first tell the remaining users to leave...

...and then send them the games_and_users_list_
This commit is contained in:
Gunter Labes 2007-11-28 18:07:33 +00:00
parent 0ef7fdf5ff
commit bf7b68fe4a
3 changed files with 4 additions and 4 deletions

View file

@ -880,7 +880,7 @@ void game::reset_history() {
end_turn_ = 0;
}
void game::end_game() {
void game::end_game(const config& games_and_users_list) {
const user_vector& users = all_game_users();
// Set the availability status for all quitting players.
for (user_vector::const_iterator user = users.begin();
@ -896,6 +896,7 @@ void game::end_game() {
}
send_data(config("leave_game"));
send_data(games_and_users_list);
players_.clear();
observers_.clear();
}

View file

@ -76,7 +76,7 @@ public:
void start_game();
//! Make everyone leave the game and clean up.
void end_game();
void end_game(const config& games_and_users_list);
void update_side_data();
bool take_side(const network::connection player, const config& cfg = config());

View file

@ -1297,9 +1297,8 @@ void server::delete_game(std::vector<game>::iterator game_it) {
}
// Put the players back in the lobby, and send
// them the games_and_users_list_ again.
game_it->send_data(games_and_users_list_);
lobby_.add_players(*game_it, true);
game_it->end_game();
game_it->end_game(games_and_users_list_);
games_.erase(game_it);
}