eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot/game game_io.cpp [multibyte]


From: eliot-dev
Subject: [Eliot-dev] eliot/game game_io.cpp [multibyte]
Date: Fri, 06 Jan 2006 21:44:11 +0000

CVSROOT:        /sources/eliot
Module name:    eliot
Branch:         multibyte
Changes by:     Olivier Teulière <address@hidden>      06/01/06 21:44:11

Modified files:
        game           : game_io.cpp 

Log message:
        Fixed a warning and indentation issues

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/game/game_io.cpp.diff?only_with_tag=multibyte&tr1=1.2.2.1&tr2=1.2.2.2&r1=text&r2=text

Patches:
Index: eliot/game/game_io.cpp
diff -u eliot/game/game_io.cpp:1.2.2.1 eliot/game/game_io.cpp:1.2.2.2
--- eliot/game/game_io.cpp:1.2.2.1      Tue Jan  3 20:42:13 2006
+++ eliot/game/game_io.cpp      Fri Jan  6 21:44:11 2006
@@ -318,10 +318,10 @@
         debug("   -- line %s",buff);
 
         if (res < 6)
-            {
-                debug("   Game::load15 invalid line -%s-\n",buff);
-                continue;
-            }
+        {
+            debug("   Game::load15 invalid line -%s-\n",buff);
+            continue;
+        }
 
         debug("              %2d | %8s | %s | %3s | %3d | %1d | %c \n",
               num, rack, word, ref, pts, player, bonus);
@@ -329,20 +329,20 @@
         // Integrity checks
         // TODO: add more checks
         if (pts < 0)
-            {
-                debug("   Game::load15 line -%s- points < 0  ?\n",buff);
-                continue;
-            }
+        {
+            debug("   Game::load15 line -%s- points < 0  ?\n",buff);
+            continue;
+        }
         if (player < 0 || player > pGame->getNPlayers())
-            {
-                debug("   Game::load15 line -%s- too much player 
(%d>%d)",buff,player,pGame->getNPlayers());
-                continue;
-            }
+        {
+            debug("   Game::load15 line -%s- too much player 
(%d>%d)",buff,player,pGame->getNPlayers());
+            continue;
+        }
         if (bonus && bonus != '*')
-            {
-                debug("   Game::load15 line -%s- wring bonus sign\n",buff);
-                continue;
-            }
+        {
+            debug("   Game::load15 line -%s- wring bonus sign\n",buff);
+            continue;
+        }
 
         // Build a rack for the correct player
         PlayedRack pldrack;
@@ -350,7 +350,7 @@
         {
             debug("   Game::load15 set rack manual returned with error 
%d\n",res);
         }
-        debug("    history rack %s\n",pldrack.toString().c_str());
+        debug("    history rack %s\n", 
convertToMb(pldrack.toString()).c_str());
 
         // Build a round
         Round round;
@@ -359,49 +359,49 @@
             round.setBonus(1);
 
         if (isalpha(ref[0]))
+        {
+            // Horizontal word
+            round.accessCoord().setDir(Coord::HORIZONTAL);
+            round.accessCoord().setRow(ref[0] - 'A' + 1);
+            round.accessCoord().setCol(atoi(ref + 1));
+
+            for (unsigned int i = 0; i < strlen(word); i++)
             {
-                // Horizontal word
-                round.accessCoord().setDir(Coord::HORIZONTAL);
-                round.accessCoord().setRow(ref[0] - 'A' + 1);
-                round.accessCoord().setCol(atoi(ref + 1));
-
-                for (unsigned int i = 0; i < strlen(word); i++)
-                    {
-                        tile = Tile(word[i]);
-
-                        if (!pGame->m_board.getTile(round.getCoord().getRow(), 
round.getCoord().getCol() + i).isEmpty())
-                            {
-                                round.addRightFromBoard(tile);
-                            }
-                        else
-                            {
-                                round.addRightFromRack(tile, islower(word[i]));
-                                pGame->m_bag.takeTile((islower(word[i])) ? 
Tile::Joker() : tile);
-                            }
-                    }
+                tile = Tile(word[i]);
+
+                if (!pGame->m_board.getTile(round.getCoord().getRow(), 
round.getCoord().getCol() + i).isEmpty())
+                {
+                    round.addRightFromBoard(tile);
+                }
+                else
+                {
+                    round.addRightFromRack(tile, islower(word[i]));
+                    pGame->m_bag.takeTile((islower(word[i])) ? Tile::Joker() : 
tile);
+                }
             }
+        }
         else
+        {
+            // Vertical word
+            round.accessCoord().setDir(Coord::VERTICAL);
+            round.accessCoord().setRow(ref[strlen(ref) - 1] - 'A' + 1);
+            round.accessCoord().setCol(atoi(ref));
+
+            for (unsigned int i = 0; i < strlen(word); i++)
             {
-                // Vertical word
-                round.accessCoord().setDir(Coord::VERTICAL);
-                round.accessCoord().setRow(ref[strlen(ref) - 1] - 'A' + 1);
-                round.accessCoord().setCol(atoi(ref));
-
-                for (unsigned int i = 0; i < strlen(word); i++)
-                    {
-                        tile = Tile(word[i]);
-
-                        if (!pGame->m_board.getTile(round.getCoord().getRow() 
+ i, round.getCoord().getCol()).isEmpty())
-                            {
-                                round.addRightFromBoard(tile);
-                            }
-                        else
-                            {
-                                round.addRightFromRack(tile, islower(word[i]));
-                                pGame->m_bag.takeTile((islower(word[i])) ? 
Tile::Joker() : tile);
-                            }
-                    }
+                tile = Tile(word[i]);
+
+                if (!pGame->m_board.getTile(round.getCoord().getRow() + i, 
round.getCoord().getCol()).isEmpty())
+                {
+                    round.addRightFromBoard(tile);
+                }
+                else
+                {
+                    round.addRightFromRack(tile, islower(word[i]));
+                    pGame->m_bag.takeTile((islower(word[i])) ? Tile::Joker() : 
tile);
+                }
             }
+        }
 
         //             pGame->m_currPlayer = player;
         //             // Update the rack for the player




reply via email to

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