Check the played word against the game rack, not against the current player rack.

This is the same in most cases, except for arbitration games where
current player may already have an assigned move.

This change notably fixes a bug when using the "Check word" button in
arbitration mode: if the current player already had an assigned move,
the checked move would often be considered invalid (wrongly).
This commit is contained in:
Olivier Teulière 2016-02-07 09:48:56 +01:00
parent 3ad45fdb91
commit 10f5e98747
2 changed files with 3 additions and 3 deletions

View file

@ -661,10 +661,9 @@ int Game::checkPlayedWord(const wstring &iCoord,
if (checkWordAndJunction && checkRack)
{
// Check that the word can be formed with the tiles in the rack:
// we first create a copy of the rack, then we remove the tiles
// we first create a copy of the game rack, then we remove the tiles
// one by one
Player *player = m_players[m_currPlayer];
Rack rack = player->getCurrentRack().getRack();
Rack rack = getHistory().getCurrentRack().getRack();
Tile t;
for (unsigned int i = 0; i < round.getWordLen(); i++)

View file

@ -173,6 +173,7 @@ public:
/// Return true if the player has played for the current turn
// XXX: not very nice API, should be a player property...
// XXX: this implementation makes no sense in arbitration mode.
virtual bool hasPlayed(unsigned int player) const { return player != currPlayer(); }
/***************