CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Jon Daniel <[EMAIL PROTECTED]>  05/01/23 21:40:53

Modified files:
        src            : multiplayer_connect.cpp 

Log message:
        Fixed #11663 which allowed remote players to be connected after
        pressing the ai button causing out of syncs in game.
        Now everyone except the host will get disconnected if the ai button is
        pressed.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.99&tr2=1.100&r1=text&r2=text

Patches:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.99 
wesnoth/src/multiplayer_connect.cpp:1.100
--- wesnoth/src/multiplayer_connect.cpp:1.99    Thu Jan 20 22:23:29 2005
+++ wesnoth/src/multiplayer_connect.cpp Sun Jan 23 21:40:53 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.99 2005/01/20 22:23:29 silene Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.100 2005/01/23 21:40:53 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <[EMAIL PROTECTED]>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -738,6 +738,18 @@
        if (ai_.pressed()) {
                for(size_t m = 0; m != combos_team_.size(); ++m) {
                        config& si = **(sides.first+m);
+                       //disconnect everyone except the host
+                       std::map<config*,network::connection>::iterator pos = 
positions_.find(&si);
+                       if (pos->first->values["description"] == 
si["description"]) {
+                               network::disconnect(pos->second);
+                               pos->second = 0;
+                       }
+                       pos->first->values.erase("taken");
+                       remove_player(pos->first->values["description"]);
+                       pos->first->values["description"] = "";
+                       pos->first->values["name"] = player_races_.front();
+                       pos->first->values["random_faction"] = "yes";
+                       pos->first->values["type"] = "";
                        si["controller"] = "ai";
                        si["description"] = _("Computer Player");
                        combos_type_[m].set_selected(2);


Reply via email to