Do not try to complete the rack when no letter was removed

This commit is contained in:
Olivier Teulière 2008-02-12 21:02:39 +00:00
parent 52b7363888
commit 0acc5cd48f

View file

@ -32,6 +32,7 @@
#include "player.h" #include "player.h"
#include "ai_player.h" #include "ai_player.h"
#include "settings.h" #include "settings.h"
#include "turn.h"
#include "debug.h" #include "debug.h"
@ -130,12 +131,17 @@ int FreeGame::start()
int FreeGame::endTurn() int FreeGame::endTurn()
{ {
// Complete the rack for the player that just played // Complete the rack for the player that just played
const Move &move = m_history.getPreviousTurn().getMove();
if (move.getType() == Move::VALID_ROUND ||
move.getType() == Move::CHANGE_LETTERS)
{
if (helperSetRackRandom(m_currPlayer, false, RACK_NEW) == 1) if (helperSetRackRandom(m_currPlayer, false, RACK_NEW) == 1)
{ {
// End of the game // End of the game
endGame(); endGame();
return 1; return 1;
} }
}
// Next player // Next player
nextPlayer(); nextPlayer();