diff --git a/game/game.cpp b/game/game.cpp index c77fb92..d1a4c49 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -118,9 +118,6 @@ void Game::realBag(Bag &ioBag) const PlayedRack Game::helperSetRackRandom(const PlayedRack &iPld, bool iCheck, set_rack_mode mode) const { - // FIXME: RACK_MANUAL shouldn't be in the enum - ASSERT(mode != RACK_MANUAL, "Invalid rack mode"); - // When iCheck is true, we must make sure that there are at least 2 vowels // and 2 consonants in the rack up to the 15th turn, and at least one of // each starting from the 16th turn. diff --git a/game/game.h b/game/game.h index 609cec6..818e645 100644 --- a/game/game.h +++ b/game/game.h @@ -206,7 +206,7 @@ public: * Setting the rack ***************/ - enum set_rack_mode {RACK_ALL, RACK_NEW, RACK_MANUAL}; + enum set_rack_mode {RACK_ALL, RACK_NEW}; void addPoints(int iPoints) { m_points += iPoints; } diff --git a/game/training.cpp b/game/training.cpp index 16b5a79..040fe49 100644 --- a/game/training.cpp +++ b/game/training.cpp @@ -84,25 +84,6 @@ int Training::setRackManual(bool iCheck, const wstring &iLetters) } -int Training::setRack(set_rack_mode iMode, bool iCheck, const wstring &iLetters) -{ - int res = 0; - switch(iMode) - { - case RACK_MANUAL: - res = setRackManual(iCheck, iLetters); - break; - case RACK_ALL: - setRackRandom(iCheck, iMode); - break; - case RACK_NEW: - setRackRandom(iCheck, iMode); - break; - } - return res; -} - - int Training::play(const wstring &iCoord, const wstring &iWord) { // Perform all the validity checks, and fill a round diff --git a/game/training.h b/game/training.h index e4f0190..fc99182 100644 --- a/game/training.h +++ b/game/training.h @@ -70,11 +70,6 @@ public: int setRackManual(bool iCheck, const wstring &iLetters); - /** - * @Deprecated: use setRackRandom() or setRackManual() instead. - */ - int setRack(set_rack_mode iMode, bool iCheck, const wstring &iLetters); - /************************* * Override the default behaviour of addPlayer(), because in training * mode we only want a human player diff --git a/qt/board_widget.cpp b/qt/board_widget.cpp index d07e5ec..341b0f8 100644 --- a/qt/board_widget.cpp +++ b/qt/board_widget.cpp @@ -97,6 +97,9 @@ void BoardWidget::paintEvent(QPaintEvent *) { for (unsigned int col = BOARD_MIN; col <= BOARD_MAX; ++col) { + const unsigned int xPos = (col - BOARD_MIN + 1) * squareSize; + const unsigned int yPos = (row - BOARD_MIN + 1) * squareSize; + // Set the brush color if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty()) { @@ -115,9 +118,7 @@ void BoardWidget::paintEvent(QPaintEvent *) painter.setBrush(L2Colour); else painter.setBrush(EmptyColour); - painter.drawRect((col - BOARD_MIN + 1) * squareSize, - (row - BOARD_MIN + 1) * squareSize, - squareSize, squareSize); + painter.drawRect(xPos, yPos, squareSize, squareSize); // Draw the letter if (m_game != NULL && !m_game->getBoard().getTile(row, col).isEmpty()) @@ -126,11 +127,8 @@ void BoardWidget::paintEvent(QPaintEvent *) if (m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER) painter.setPen(JokerColour); painter.setFont(letterFont); - painter.drawText((col - BOARD_MIN + 1) * squareSize, - (row - BOARD_MIN + 1) * squareSize + 1, - squareSize, squareSize, - Qt::AlignCenter, - qfw(wstring(1, chr))); + painter.drawText(xPos, yPos + 1, squareSize, squareSize, + Qt::AlignCenter, qfw(wstring(1, chr))); painter.setPen(NormalColour); // Draw the points of the tile @@ -138,8 +136,8 @@ void BoardWidget::paintEvent(QPaintEvent *) !m_game->getBoard().getCharAttr(row, col) & ATTR_JOKER) { painter.setFont(pointsFont); - painter.drawText((col - BOARD_MIN + 1) * squareSize + squareSize * (1 - pointsCoeff), - (row - BOARD_MIN + 1) * squareSize + squareSize * (1 - pointsCoeff) + 1, + painter.drawText(xPos + squareSize * (1 - pointsCoeff), + yPos + squareSize * (1 - pointsCoeff) + 1, squareSize * pointsCoeff, squareSize * pointsCoeff + 3, Qt::AlignRight | Qt::AlignBottom, QString("%1").arg(m_game->getBoard().getTile(row, col).getPoints())); @@ -148,9 +146,9 @@ void BoardWidget::paintEvent(QPaintEvent *) } } // Draw the coordinates + painter.setFont(letterFont); for (unsigned x = 1; x <= BOARD_MAX - BOARD_MIN + 1; ++x) { - painter.setFont(letterFont); painter.drawText(x * squareSize, 1, squareSize, squareSize, Qt::AlignCenter,