Improve the detection of finished games for duplicate and arbitration modes

This commit is contained in:
Olivier Teulière 2012-10-05 01:42:46 +02:00
parent f1123e1229
commit bcc2aedbff
6 changed files with 8 additions and 11 deletions

View file

@ -160,7 +160,7 @@ void Duplicate::start()
bool Duplicate::isFinished() const
{
return m_finished;
return !canDrawRack(m_players[0]->getHistory().getCurrentRack(), true);
}
@ -351,7 +351,6 @@ void Duplicate::endGame()
LOG_INFO("End of the game");
// No more master move
setMasterMove(Move());
m_finished = true;
}

View file

@ -49,7 +49,7 @@ INIT_LOGGER(game, FreeGame);
FreeGame::FreeGame(const GameParams &iParams)
: Game(iParams)
: Game(iParams), m_finished(false)
{
}
@ -150,6 +150,7 @@ void FreeGame::start()
bool FreeGame::isFinished() const
{
// FIXME: the flag is never reset to false!
return m_finished;
}

View file

@ -81,7 +81,10 @@ public:
int pass(const wstring &iToChange);
private:
// Private constructor to force using the GameFactory class
/// True if the game is finished, false otherwise
bool m_finished;
/// Private constructor to force using the GameFactory class
FreeGame(const GameParams &iParams);
/// Make the AI player whose ID is p play its turn

View file

@ -54,7 +54,6 @@ Game::Game(const GameParams &iParams):
{
m_points = 0;
m_currPlayer = 0;
m_finished = false;
}

View file

@ -230,8 +230,6 @@ protected:
/// Bag
Bag m_bag;
bool m_finished;
/*********************************************************
* Helper functions
*********************************************************/

View file

@ -141,10 +141,7 @@ void ArbitAssignments::refresh()
labelMasterMove->setText(label);
}
if (m_game->isFinished())
{
setEnabled(false);
}
setEnabled(!m_game->isFinished());
enableAssignmentButtons();
buttonSelectMaster->setEnabled(isAssignMasterAllowed());