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

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

[Wesnoth-cvs-commits] wesnoth/src playturn.cpp


From: Jon Daniel
Subject: [Wesnoth-cvs-commits] wesnoth/src playturn.cpp
Date: Thu, 27 Jan 2005 11:17:15 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Jon Daniel <address@hidden>     05/01/27 16:17:15

Modified files:
        src            : playturn.cpp 

Log message:
        Fixed replacing players with observers using the GUI causes out of sync.

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

Patches:
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.322 wesnoth/src/playturn.cpp:1.323
--- wesnoth/src/playturn.cpp:1.322      Sun Jan 23 16:28:39 2005
+++ wesnoth/src/playturn.cpp    Thu Jan 27 16:17:13 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.322 2005/01/23 16:28:39 j_daniel Exp $ */
+/* $Id: playturn.cpp,v 1.323 2005/01/27 16:17:13 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2653,22 +2653,26 @@
                //make the player an AI, and redo this turn, in case
                //it was the current player's team who has just changed into
                //an AI.
-               if(action == 0) {
-                       teams_[side].make_ai();
-                       return PROCESS_RESTART_TURN;
-               } else if(action == 1) {
-                       teams_[side].make_human();
-                       return PROCESS_RESTART_TURN;
-               } else if(action > 2) {
-                       const size_t index = size_t(action - 3);
-                       if(index < observers.size()) {
-                               
change_side_controller(cfg["side_drop"],observers[index],true);
-                       }
-
-                       teams_[side].make_human();
-                       return PROCESS_RESTART_TURN;
+               switch(action) {
+                       case 0:
+                               teams_[side].make_ai();
+                               return PROCESS_RESTART_TURN;
+                       case 1:
+                               teams_[side].make_human();
+                               return PROCESS_RESTART_TURN;
+                       default:
+                               if (action > 2) {
+                                       const size_t index = 
static_cast<size_t>(action - 3);
+                                       if (index < observers.size()) {
+                                               teams_[side].make_network();
+                                               
change_side_controller(cfg["side_drop"], observers[index]);
+                                       } else {
+                                               teams_[side].make_ai();
+                                       }
+                                       return PROCESS_RESTART_TURN;
+                               }
+                               break;
                }
-
                throw network::error("");
        }
 




reply via email to

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