eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] Changes to eliot/game/board.cpp


From: eliot-dev
Subject: [Eliot-dev] Changes to eliot/game/board.cpp
Date: Sat, 05 Nov 2005 08:57:00 -0500

Index: eliot/game/board.cpp
diff -u eliot/game/board.cpp:1.10 eliot/game/board.cpp:1.11
--- eliot/game/board.cpp:1.10   Sat Nov  5 11:01:58 2005
+++ eliot/game/board.cpp        Sat Nov  5 13:56:59 2005
@@ -153,9 +153,9 @@
     Tile t;
     int row, col;
 
-    row = iRound.getRow();
-    col = iRound.getCol();
-    if (iRound.getDir() == Coord::HORIZONTAL)
+    row = iRound.getCoord().getRow();
+    col = iRound.getCoord().getCol();
+    if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
     {
         for (int i = 0; i < iRound.getWordLen(); i++)
         {
@@ -194,9 +194,9 @@
 {
     int row, col;
 
-    row = iRound.getRow();
-    col = iRound.getCol();
-    if (iRound.getDir() == Coord::HORIZONTAL)
+    row = iRound.getCoord().getRow();
+    col = iRound.getCoord().getCol();
+    if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
     {
         for (int i = 0; i < iRound.getWordLen(); i++)
         {
@@ -248,8 +248,8 @@
     pts = 0;
     ptscross = 0;
     wordmul = 1;
-    row = iRound.getRow();
-    col = iRound.getCol();
+    row = iRound.getCoord().getRow();
+    col = iRound.getCoord().getCol();
 
     /* Is the word an extension of another word? */
     if (!iTilesMx[row][col - 1].isEmpty() ||
@@ -314,7 +314,7 @@
     if (isolated && !firstturn)
         return 5;
     /* The first word must be horizontal */
-    if (firstturn && iRound.getDir() == Coord::VERTICAL)
+    if (firstturn && iRound.getCoord().getDir() == Coord::VERTICAL)
         return 6;
     /* The first word must cover the H8 square */
     if (firstturn
@@ -334,28 +334,24 @@
 
 int Board::checkRound(Round &iRound, bool firstturn)
 {
-    if (iRound.getDir() == Coord::HORIZONTAL)
+    if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
+    {
         return checkRoundAux(m_tilesRow, m_crossRow,
                              m_pointRow, m_jokerRow,
                              iRound, firstturn);
+    }
     else
     {
-        int res, tmp;
-
         // XXX: ugly!
-        /* Exchange the coordinates temporarily */
-        tmp = iRound.getRow();
-        iRound.setRow(iRound.getCol());
-        iRound.setCol(tmp);
-
-        res = checkRoundAux(m_tilesCol, m_crossCol,
-                            m_pointCol, m_jokerCol,
-                            iRound, firstturn);
-
-        /* Restore the coordinates */
-        tmp = iRound.getRow();
-        iRound.setRow(iRound.getCol());
-        iRound.setCol(tmp);
+        // Exchange the coordinates temporarily
+        iRound.accessCoord().swap();
+
+        int res = checkRoundAux(m_tilesCol, m_crossCol,
+                                m_pointCol, m_jokerCol,
+                                iRound, firstturn);
+
+        // Restore the coordinates
+        iRound.accessCoord().swap();
 
         return res;
     }
@@ -367,9 +363,9 @@
     Tile t;
     int row, col;
 
-    row = iRound.getRow();
-    col = iRound.getCol();
-    if (iRound.getDir() == Coord::HORIZONTAL)
+    row = iRound.getCoord().getRow();
+    col = iRound.getCoord().getCol();
+    if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
     {
         for (int i = 0; i < iRound.getWordLen(); i++)
         {




reply via email to

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