mail[Wesnoth-commits] r34138 - in /trunk/src/server: game.cpp game.hpp


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

Header


Content

Posted by soliton . de on March 26, 2009 - 01:45:
Author: soliton
Date: Thu Mar 26 01:45:09 2009
New Revision: 34138

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34138&view=rev
Log:
also log leaving players on game destruction

Modified:
    trunk/src/server/game.cpp
    trunk/src/server/game.hpp

Modified: trunk/src/server/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/game.cpp?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- trunk/src/server/game.cpp (original)
+++ trunk/src/server/game.cpp Thu Mar 26 01:45:09 2009
@@ -83,6 +83,10 @@
 
 game::~game()
 {
+       user_vector users = all_game_users();
+       for (user_vector::const_iterator u = users.begin(); u != users.end(); 
++u) {
+               remove_player(*u, false, true);
+       }
        for(std::vector<simple_wml::document*>::iterator i = 
history_.begin(); i != history_.end(); ++i) {
                delete *i;
        }
@@ -935,7 +939,7 @@
        return true;
 }
 
-bool game::remove_player(const network::connection player, const bool 
disconnect) {
+bool game::remove_player(const network::connection player, const bool 
disconnect, const bool destruct) {
        if (!is_member(player)) {
                ERR_GAME << "ERROR: User is not in this game. (socket: "
                        << player << ")\n";
@@ -976,6 +980,8 @@
                << (observer ? " as an observer" : "")
                << (disconnect ? " and disconnected" : "")
                << ". (socket: " << user->first << ")\n";
+       // No need to do anything more when the game gets destructed.
+       if (destruct) return true;
        if (game_ended) {
                send_server_message_to_all((user->second.name() + " ended the 
game.").c_str(), player);
                return true;

Modified: trunk/src/server/game.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/game.hpp?rev=34138&r1=34137&r2=34138&view=diff
==============================================================================
--- trunk/src/server/game.hpp (original)
+++ trunk/src/server/game.hpp Thu Mar 26 01:45:09 2009
@@ -96,7 +96,7 @@
         *                            no more players or the host left on a 
not yet
         *                            started game.
         */
-       bool remove_player(const network::connection player, const bool 
disconnect=false);
+       bool remove_player(const network::connection player, const bool 
disconnect=false, const bool destruct=false);
 
        /** Adds players and observers into one vector and returns that. */
        const user_vector all_game_users() const;




Related Messages


Powered by MHonArc, Updated Thu Mar 26 02:20:35 2009