mail[Wesnoth-commits] r13878 - /trunk/src/server/game.cpp


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

Header


Content

Posted by edb on October 10, 2006 - 11:44:
Author: edb
Date: Tue Oct 10 11:44:06 2006
New Revision: 13878

URL: http://svn.gna.org/viewcvs/wesnoth?rev=13878&view=rev
Log:
fix https://gna.org/bugs/?7351

Modified:
    trunk/src/server/game.cpp

Modified: trunk/src/server/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/game.cpp?rev=13878&r1=13877&r2=13878&view=diff
==============================================================================
--- trunk/src/server/game.cpp (original)
+++ trunk/src/server/game.cpp Tue Oct 10 11:44:06 2006
@@ -396,11 +396,14 @@
 
                //if a player gives up their last side, make them an observer
                if (sides_.count(sock) == 1){
-                       if (sock == owner_)
-                               host_leave = true;
-
                        observers_.push_back(*p);
                        players_.erase(p);
+
+                       if (sock == owner_) {
+                               host_leave = true;
+                               if (!players_.empty())
+                                       owner_ = players_.front();
+                       }
 
                        //tell others that the player becomes an observer
                        config cfg_observer = 
construct_server_message(find_player(sock)->name() + " becomes observer");
@@ -449,8 +452,8 @@
                        if (side_controllers_[i] == "ai"){
                                change["side"] = lexical_cast<std::string, 
unsigned int>(i + 1);
                                change["controller"] = "ai";
-                               network::queue_data(response, sock_entering);
-                               sides_.insert(std::pair<const 
network::connection,size_t>(sock_entering, i));
+                               network::queue_data(response, owner_);
+                               sides_.insert(std::pair<const 
network::connection,size_t>(owner_, i));
                        }
                }
                sides_.erase(sock);




Related Messages


Powered by MHonArc, Updated Tue Oct 10 12:00:50 2006