/[eliot]/eliot/game/board.cpp
ViewVC logotype

Diff of /eliot/game/board.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by ipkiss, Sat Nov 5 11:01:58 2005 UTC revision 1.11 by ipkiss, Sat Nov 5 13:56:59 2005 UTC
# Line 153  void Board::addRound(const Dictionary &i Line 153  void Board::addRound(const Dictionary &i
153      Tile t;      Tile t;
154      int row, col;      int row, col;
155    
156      row = iRound.getRow();      row = iRound.getCoord().getRow();
157      col = iRound.getCol();      col = iRound.getCoord().getCol();
158      if (iRound.getDir() == Coord::HORIZONTAL)      if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
159      {      {
160          for (int i = 0; i < iRound.getWordLen(); i++)          for (int i = 0; i < iRound.getWordLen(); i++)
161          {          {
# Line 194  void Board::removeRound(const Dictionary Line 194  void Board::removeRound(const Dictionary
194  {  {
195      int row, col;      int row, col;
196    
197      row = iRound.getRow();      row = iRound.getCoord().getRow();
198      col = iRound.getCol();      col = iRound.getCoord().getCol();
199      if (iRound.getDir() == Coord::HORIZONTAL)      if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
200      {      {
201          for (int i = 0; i < iRound.getWordLen(); i++)          for (int i = 0; i < iRound.getWordLen(); i++)
202          {          {
# Line 248  int Board::checkRoundAux(Matrix<Tile> &i Line 248  int Board::checkRoundAux(Matrix<Tile> &i
248      pts = 0;      pts = 0;
249      ptscross = 0;      ptscross = 0;
250      wordmul = 1;      wordmul = 1;
251      row = iRound.getRow();      row = iRound.getCoord().getRow();
252      col = iRound.getCol();      col = iRound.getCoord().getCol();
253    
254      /* Is the word an extension of another word? */      /* Is the word an extension of another word? */
255      if (!iTilesMx[row][col - 1].isEmpty() ||      if (!iTilesMx[row][col - 1].isEmpty() ||
# Line 314  int Board::checkRoundAux(Matrix<Tile> &i Line 314  int Board::checkRoundAux(Matrix<Tile> &i
314      if (isolated && !firstturn)      if (isolated && !firstturn)
315          return 5;          return 5;
316      /* The first word must be horizontal */      /* The first word must be horizontal */
317      if (firstturn && iRound.getDir() == Coord::VERTICAL)      if (firstturn && iRound.getCoord().getDir() == Coord::VERTICAL)
318          return 6;          return 6;
319      /* The first word must cover the H8 square */      /* The first word must cover the H8 square */
320      if (firstturn      if (firstturn
# Line 334  int Board::checkRoundAux(Matrix<Tile> &i Line 334  int Board::checkRoundAux(Matrix<Tile> &i
334    
335  int Board::checkRound(Round &iRound, bool firstturn)  int Board::checkRound(Round &iRound, bool firstturn)
336  {  {
337      if (iRound.getDir() == Coord::HORIZONTAL)      if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
338        {
339          return checkRoundAux(m_tilesRow, m_crossRow,          return checkRoundAux(m_tilesRow, m_crossRow,
340                               m_pointRow, m_jokerRow,                               m_pointRow, m_jokerRow,
341                               iRound, firstturn);                               iRound, firstturn);
342        }
343      else      else
344      {      {
         int res, tmp;  
   
345          // XXX: ugly!          // XXX: ugly!
346          /* Exchange the coordinates temporarily */          // Exchange the coordinates temporarily
347          tmp = iRound.getRow();          iRound.accessCoord().swap();
348          iRound.setRow(iRound.getCol());  
349          iRound.setCol(tmp);          int res = checkRoundAux(m_tilesCol, m_crossCol,
350                                    m_pointCol, m_jokerCol,
351          res = checkRoundAux(m_tilesCol, m_crossCol,                                  iRound, firstturn);
352                              m_pointCol, m_jokerCol,  
353                              iRound, firstturn);          // Restore the coordinates
354            iRound.accessCoord().swap();
         /* Restore the coordinates */  
         tmp = iRound.getRow();  
         iRound.setRow(iRound.getCol());  
         iRound.setCol(tmp);  
355    
356          return res;          return res;
357      }      }
# Line 367  void Board::testRound(const Round &iRoun Line 363  void Board::testRound(const Round &iRoun
363      Tile t;      Tile t;
364      int row, col;      int row, col;
365    
366      row = iRound.getRow();      row = iRound.getCoord().getRow();
367      col = iRound.getCol();      col = iRound.getCoord().getCol();
368      if (iRound.getDir() == Coord::HORIZONTAL)      if (iRound.getCoord().getDir() == Coord::HORIZONTAL)
369      {      {
370          for (int i = 0; i < iRound.getWordLen(); i++)          for (int i = 0; i < iRound.getWordLen(); i++)
371          {          {

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26