diff --git a/game/arbitration.cpp b/game/arbitration.cpp index e028060..c088dab 100644 --- a/game/arbitration.cpp +++ b/game/arbitration.cpp @@ -51,7 +51,7 @@ void Arbitration::setRackRandom() const PlayedRack &newRack = helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW); - setGameAndPlayersRack(newRack); + setGameAndPlayersRack(newRack, true); } @@ -68,7 +68,7 @@ void Arbitration::setRackManual(const wstring &iLetters) // As a result, we simply make all the letters uppercase const wstring &upperLetters = toUpper(iLetters); const PlayedRack &newRack = helperSetRackManual(false, upperLetters); - setGameAndPlayersRack(newRack); + setGameAndPlayersRack(newRack, true); } diff --git a/game/duplicate.cpp b/game/duplicate.cpp index d2a79d5..33e0e64 100644 --- a/game/duplicate.cpp +++ b/game/duplicate.cpp @@ -132,12 +132,12 @@ void Duplicate::start() bool fillRacks = Settings::Instance().getBool("arbitration.fill-rack"); if (isArbitrationGame() && !fillRacks && !hasMasterGame()) - setGameAndPlayersRack(getHistory().getCurrentRack()); + setGameAndPlayersRack(getHistory().getCurrentRack(), true); else { const PlayedRack &newRack = helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW); - setGameAndPlayersRack(newRack); + setGameAndPlayersRack(newRack, true); } } catch (EndGameException &e) diff --git a/game/game.cpp b/game/game.cpp index 95b1aa3..fae5969 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -682,7 +682,7 @@ int Game::checkPlayedWord(const wstring &iCoord, } -void Game::setGameAndPlayersRack(const PlayedRack &iRack) +void Game::setGameAndPlayersRack(const PlayedRack &iRack, bool iWithNoMove) { // Set the game rack Command *pCmd = new GameRackCmd(*this, iRack); @@ -695,15 +695,18 @@ void Game::setGameAndPlayersRack(const PlayedRack &iRack) accessNavigation().addAndExecute(pCmd); } - // Assign a "no move" pseudo-move to all the players. - // This avoids the need to distinguish between "has not played yet" - // and "has played with no move". - // This is also practical to know at which turn the warnings, penalties - // and solos should be assigned. - BOOST_FOREACH(Player *player, m_players) + if (iWithNoMove) { - Command *pCmd = new PlayerMoveCmd(*player, Move()); - accessNavigation().addAndExecute(pCmd); + // Assign a "no move" pseudo-move to all the players. + // This avoids the need to distinguish between "has not played yet" + // and "has played with no move" in duplicate and arbitration modes. + // This is also practical to know at which turn the warnings, penalties + // and solos should be assigned. + BOOST_FOREACH(Player *player, m_players) + { + Command *pCmd = new PlayerMoveCmd(*player, Move()); + accessNavigation().addAndExecute(pCmd); + } } } diff --git a/game/game.h b/game/game.h index 0b14561..9dd7b2b 100644 --- a/game/game.h +++ b/game/game.h @@ -324,7 +324,7 @@ protected: * Helper function to set the game rack and the players rack at the same time. * Shouldn't be used in free game mode. */ - void setGameAndPlayersRack(const PlayedRack &iRack); + void setGameAndPlayersRack(const PlayedRack &iRack, bool iWithNoMove); void nextPlayer(); diff --git a/game/topping.cpp b/game/topping.cpp index fd7a04a..9e56ef0 100644 --- a/game/topping.cpp +++ b/game/topping.cpp @@ -65,7 +65,7 @@ void Topping::start() { const PlayedRack &newRack = helperSetRackRandom(getHistory().getCurrentRack(), true, RACK_NEW); - setGameAndPlayersRack(newRack); + setGameAndPlayersRack(newRack, false); } catch (EndGameException &e) { @@ -121,13 +121,9 @@ void Topping::turnTimeOut() m_board.removeTestRound(); - // Commented out, because the player already has - // an empty move by default -#if 0 // The player didn't find the move Command *pCmd = new PlayerMoveCmd(*m_players[m_currPlayer], Move()); accessNavigation().addAndExecute(pCmd); -#endif // Give a penalty to the player // XXX: should we give the penalty directly in the NO_MOVE move?