send lobby diffs seperately;...

...fixes bug #13099: MP lobby player list becomes inaccurate over time
This commit is contained in:
Gunter Labes 2009-03-03 09:28:16 +00:00
parent 680ab0c6a6
commit c4c439e7e2
3 changed files with 8 additions and 8 deletions

View file

@ -3,6 +3,7 @@ Version 1.5.12+svn:
* updated translations: Chinese (Simplified)
* Miscellaneous and bug fixes:
* Fix another savegame cache corruption
* Fixed bug #13099: MP lobby player list becomes inaccurate over time
Version 1.5.12:
* Add-on server:

View file

@ -564,7 +564,8 @@ static void enter_lobby_mode(game_display& disp, const config& game_config, mp::
gui::show_error_message(disp, error.message);
}
}
//update lobby content
// update lobby content unconditionally because we might have left only after the
// game ended in which case we ignored the gamelist and need to request it again
network::send_data(config("refresh_lobby"), 0, true);
break;
case mp::ui::CREATE:

View file

@ -2229,10 +2229,9 @@ void server::delete_game(std::vector<wesnothd::game*>::iterator game_it) {
// Send a diff of the gamelist with the game deleted to players in the lobby
simple_wml::document diff;
bool send_diff = false;
if(make_delete_diff(*gamelist, "gamelist", "game",
(*game_it)->description(), diff)) {
send_diff = true;
lobby_.send_data(diff);
}
// Delete the game from the games_and_users_list_.
@ -2247,6 +2246,7 @@ void server::delete_game(std::vector<wesnothd::game*>::iterator game_it) {
LOG_SERVER << "Could not find game (" << (*game_it)->id()
<< ") to delete in games_and_users_list_.\n";
}
const wesnothd::user_vector& users = (*game_it)->all_game_users();
// Set the availability status for all quitting users.
for (wesnothd::user_vector::const_iterator user = users.begin();
@ -2255,18 +2255,16 @@ void server::delete_game(std::vector<wesnothd::game*>::iterator game_it) {
const wesnothd::player_map::iterator pl = players_.find(*user);
if (pl != players_.end()) {
pl->second.mark_available();
simple_wml::document udiff;
if (make_change_diff(games_and_users_list_.root(), NULL,
"user", pl->second.config_address(), diff)) {
send_diff = true;
"user", pl->second.config_address(), udiff)) {
lobby_.send_data(udiff);
}
} else {
ERR_SERVER << "ERROR: delete_game(): Could not find user in players_. (socket: "
<< *user << ")\n";
}
}
if (send_diff) {
lobby_.send_data(diff);
}
//send users in the game a notification to leave the game since it has ended
static simple_wml::document leave_game_doc("[leave_game]\n[/leave_game]\n", simple_wml::INIT_COMPRESSED);