Author: loonycyborg
Date: Sat Mar 24 16:32:25 2012
New Revision: 53641
URL: http://svn.gna.org/viewcvs/wesnoth?rev=53641&view=rev
Log:
Properly send diffs to other clients on logins/disconnects.
Modified:
branches/asio_wesnothd/src/server/server.cpp
Modified: branches/asio_wesnothd/src/server/server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/asio_wesnothd/src/server/server.cpp?rev=53641&r1=53640&r2=53641&view=diff
==============================================================================
--- branches/asio_wesnothd/src/server/server.cpp (original)
+++ branches/asio_wesnothd/src/server/server.cpp Sat Mar 24 16:32:25 2012
@@ -1107,6 +1107,11 @@
send_to_player(socket, games_and_users_list_);
read_from_player(socket);
room_list_.enter_room("lobby", socket);
+
+ // Send other players in the lobby the update that the player has joined
+ simple_wml::document diff;
+ make_add_diff(games_and_users_list_.root(), NULL, "user", diff);
+ room_list_.send_to_room("lobby", diff, socket);
}
void server::read_from_player(socket_ptr socket)
@@ -1320,8 +1325,13 @@
const simple_wml::node::child_list& users =
games_and_users_list_.root().children("user");
const size_t index = std::find(users.begin(), users.end(),
iter->info.config_address()) - users.begin();
+ // Notify other players in lobby
+ simple_wml::document diff;
+ if(make_delete_diff(games_and_users_list_.root(), NULL, "user",
+ iter->info.config_address(), diff)) {
+ room_list_.send_to_room("lobby", diff, socket);
+ }
games_and_users_list_.root().remove_child("user", index);
- /* TODO: send diff */
LOG_SERVER << ip << "\t" << iter->info.name()
<< "\twas logged off" << "\n";
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits