eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/game duplicate.cpp freegame.cpp


From: Olivier Teulière
Subject: [Eliot-dev] eliot/game duplicate.cpp freegame.cpp
Date: Sun, 23 Nov 2008 17:05:20 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>      08/11/23 17:05:19

Modified files:
        game           : duplicate.cpp freegame.cpp 

Log message:
         - Duplicate: end turns after defining the new rack, not before
         - FreeGame: create an additional turn after defining the initial rack

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/game/duplicate.cpp?cvsroot=eliot&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/eliot/game/freegame.cpp?cvsroot=eliot&r1=1.27&r2=1.28

Patches:
Index: duplicate.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/duplicate.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- duplicate.cpp       23 Nov 2008 17:04:40 -0000      1.25
+++ duplicate.cpp       23 Nov 2008 17:05:13 -0000      1.26
@@ -116,6 +116,11 @@
             // Nobody has played yet in this round
             m_hasPlayed[i] = false;
         }
+        // Change the turn _after_ setting the new rack, so that when going
+        // back in the history the rack is already there. The turn boundaries
+        // must be just before player actions, otherwise restoring the game
+        // doesn't work properly.
+        accessNavigation().newTurn();
     }
     catch (EndGameException &e)
     {
@@ -196,7 +201,6 @@
         if (bestPlayer == NULL)
         {
             // Nobody played a valid round. Go to the next turn...
-            accessNavigation().newTurn();
             start();
             return;
         }
@@ -253,8 +257,6 @@
         }
     }
 
-    accessNavigation().newTurn();
-
     // Start next turn...
     start();
 }

Index: freegame.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/game/freegame.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- freegame.cpp        23 Nov 2008 17:04:40 -0000      1.27
+++ freegame.cpp        23 Nov 2008 17:05:18 -0000      1.28
@@ -128,6 +128,8 @@
 
     m_currPlayer = 0;
 
+    accessNavigation().newTurn();
+
     // If the first player is an AI, make it play now
     if (!m_players[m_currPlayer]->isHuman())
     {




reply via email to

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