actually delete the game from the list...

...before making the diff + some comment cleanups
This commit is contained in:
Gunter Labes 2009-02-11 18:59:11 +00:00
parent 781043f211
commit 817ad30b3c

View file

@ -1848,8 +1848,7 @@ void server::process_data_lobby(const network::connection sock,
}
/**
* Process data sent by a player in a game. Note that 'data' by default gets
* broadcasted and saved in the replay.
* Process data sent from a member of a game.
*/
void server::process_data_game(const network::connection sock,
simple_wml::document& data) {
@ -2192,9 +2191,7 @@ void server::process_data_game(const network::connection sock,
} else if (data.child("message")) {
g->process_message(data, pl);
return;
// Data to store and broadcast.
} else if (data.child("stop_updates")) {
// if (g->started()) g->record_data(data);
g->send_data(data, sock);
return;
// Data to ignore.
@ -2215,15 +2212,6 @@ void server::delete_game(std::vector<wesnothd::game*>::iterator game_it) {
simple_wml::node* const gamelist = games_and_users_list_.child("gamelist");
assert(gamelist != NULL);
// 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;
}
// Delete the game from the games_and_users_list_.
const simple_wml::node::child_list& games = gamelist->children("game");
const simple_wml::node::child_list::const_iterator g =
@ -2236,6 +2224,15 @@ 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";
}
// 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;
}
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();