wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src/server game.cpp


From: ott
Subject: [Wesnoth-cvs-commits] wesnoth/src/server game.cpp
Date: Tue, 17 May 2005 17:00:18 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     ott <address@hidden>    05/05/17 21:00:18

Modified files:
        src/server     : game.cpp 

Log message:
        Stop "control garbagestring playername" working if "garbagestring" isn't
        a valid side.  Before this change it really meant "control 1 playername"
        but bypassed the checks for side 1 already having a controller, so it
        would make the game creator an observer: somewhat unexpected!

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/game.cpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text

Patches:
Index: wesnoth/src/server/game.cpp
diff -u wesnoth/src/server/game.cpp:1.32 wesnoth/src/server/game.cpp:1.33
--- wesnoth/src/server/game.cpp:1.32    Wed Apr 27 21:11:44 2005
+++ wesnoth/src/server/game.cpp Tue May 17 21:00:18 2005
@@ -217,6 +217,16 @@
 
        const std::string& side = cfg["side"];
 
+       std::set<std::string>::const_iterator k;
+       for(k = sides_taken_.begin(); k != sides_taken_.end(); ++k) {
+               if(*k == side) break;
+       }
+
+       if(k == sides_taken_.end()) {
+               static const std::string notfound = "Side not found";
+               return notfound;
+       }
+
        for(std::map<network::connection,std::string>::const_iterator j = 
sides_.begin(); j != sides_.end(); ++j) {
                if(j->second == side) {
                        static const std::string already = "This side is 
already controlled by a player";
@@ -224,7 +234,9 @@
                }
        }
 
-       if(sides_.count(*i) == 1) {
+       // FIXME:
+       // what is so bad about a player controlling more than one side?
+       if(sides_.count(*i) > 0) {
                static const std::string already = "Player already controls a 
side";
                return already;
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]