mail[Wesnoth-commits] r25305 - /branches/1.4/src/server/server.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by martinxyz on March 29, 2008 - 23:08:
Author: martinxyz
Date: Sat Mar 29 23:08:30 2008
New Revision: 25305

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25305&view=rev
Log:
merged r25303 and r25304 from trunk (made server sending diffs when a game 
exists more efficient)

Modified:
    branches/1.4/src/server/server.cpp

Modified: branches/1.4/src/server/server.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/src/server/server.cpp?rev=25305&r1=25304&r2=25305&view=diff
==============================================================================
--- branches/1.4/src/server/server.cpp (original)
+++ branches/1.4/src/server/server.cpp Sat Mar 29 23:08:30 2008
@@ -1472,9 +1472,18 @@
 
 void server::delete_game(std::vector<game*>::iterator game_it) {
        metrics_.game_terminated((*game_it)->termination_reason());
-       // Delete the game from the games_and_users_list_.
+
        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;
+       if(make_delete_diff(*gamelist, "gamelist", "game",
+                           (*game_it)->description(), diff)) {
+               lobby_.send_data(diff);
+       }
+
+       // 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 =
                std::find(games.begin(), games.end(), 
(*game_it)->description());
@@ -1505,11 +1514,11 @@
        (*game_it)->send_data(leave_game_doc);
        // Put the remaining users back in the lobby.
        lobby_.add_players(**game_it, true);
+
+       (*game_it)->send_data(games_and_users_list_);
+
        delete *game_it;
        games_.erase(game_it);
-
-       //refresh the lobby for everyone, including the players who were in 
the game
-       send_gamelist_diff();
 }
 
 void server::send_gamelist_diff(network::connection exclude)




Related Messages


Powered by MHonArc, Updated Sun Mar 30 00:02:34 2008