Author: martinxyz
Date: Sun Apr 6 13:42:43 2008
New Revision: 25622
URL: http://svn.gna.org/viewcvs/wesnoth?rev=25622&view=rev
Log:
fixed bug #11440 (player availability status in the lobby not updated)
Userlist diffs were missing for players joining a game, and for the last player
leaving a game.
Modified:
trunk/src/server/server.cpp
Modified: trunk/src/server/server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/server.cpp?rev=25622&r1=25621&r2=25622&view=diff
==============================================================================
--- trunk/src/server/server.cpp (original)
+++ trunk/src/server/server.cpp Sun Apr 6 13:42:43 2008
@@ -287,7 +287,6 @@
simple_wml::document& data);
void delete_game(std::vector<game*>::iterator game_it);
- void send_gamelist_diff(network::connection sock=0);
void update_game_in_lobby(const game* g, network::connection exclude=0);
};
@@ -1146,10 +1145,11 @@
//send notification of changes to the game and user
simple_wml::document diff;
-
if(make_change_diff(*games_and_users_list_.root().child("gamelist"),
- "gamelist", "game", (*g)->description(),
diff) ||
- make_change_diff(games_and_users_list_.root(), NULL,
- "user", pl->second.config_address(), diff))
{
+ bool diff1 =
make_change_diff(*games_and_users_list_.root().child("gamelist"),
+ "gamelist", "game",
(*g)->description(), diff);
+ bool diff2 = make_change_diff(games_and_users_list_.root(),
NULL,
+ "user",
pl->second.config_address(), diff);
+ if (diff1 || diff2) {
lobby_.send_data(diff);
}
}
@@ -1387,10 +1387,11 @@
// Send all other players in the lobby the update to
the gamelist.
simple_wml::document diff;
-
if(make_change_diff(*games_and_users_list_.root().child("gamelist"),
- "gamelist", "game",
g->description(), diff) ||
- make_change_diff(games_and_users_list_.root(), NULL,
- "user",
pl->second.config_address(), diff)) {
+ bool diff1 =
make_change_diff(*games_and_users_list_.root().child("gamelist"),
+ "gamelist", "game",
g->description(), diff);
+ bool diff2 =
make_change_diff(games_and_users_list_.root(), NULL,
+ "user",
pl->second.config_address(), diff);
+ if (diff1 || diff2) {
lobby_.send_data(diff, sock);
}
@@ -1449,6 +1450,8 @@
}
// Send the removed user the lobby game list.
send_doc(games_and_users_list_, user);
+ // FIXME: should also send a user diff to the lobby
+ // to mark this player as available for others
}
return;
// If info is being provided about the game state.
@@ -1496,9 +1499,10 @@
// 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)) {
- lobby_.send_data(diff);
+ send_diff = true;
}
// Delete the game from the games_and_users_list_.
@@ -1521,10 +1525,17 @@
const player_map::iterator pl = players_.find(*user);
if (pl != players_.end()) {
pl->second.mark_available();
+ if (make_change_diff(games_and_users_list_.root(), NULL,
+ "user",
pl->second.config_address(), diff)) {
+ send_diff = true;
+ }
} else {
ERR_SERVER << "ERROR: 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
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits