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 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"); LOG_INFO("End of the game");
// No more master move // No more master move
setMasterMove(Move()); setMasterMove(Move());
m_finished = true;
} }

View file

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

View file

@ -81,7 +81,10 @@ public:
int pass(const wstring &iToChange); int pass(const wstring &iToChange);
private: 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); FreeGame(const GameParams &iParams);
/// Make the AI player whose ID is p play its turn /// 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_points = 0;
m_currPlayer = 0; m_currPlayer = 0;
m_finished = false;
} }

View file

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

View file

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