GameSignals: update member variables correctly when the game is destroyed

This commit is contained in:
Olivier Teulière 2013-01-10 21:41:07 +01:00
parent b7825e1998
commit 02f284f3ae

View file

@ -40,17 +40,22 @@ void GameSignals::notifyGameChanged(PublicGame *iGame)
m_game = iGame;
emit gameChangedNonConst(iGame);
emit gameChanged(iGame);
if (iGame != NULL)
notifyGameUpdated();
notifyGameUpdated();
}
void GameSignals::notifyGameUpdated()
{
emit gameUpdated();
if (m_game == NULL)
{
m_currentTurn = 0;
m_lastTurn = 0;
m_lastGameRack = PlayedRack();
m_lastCurrPlayerRack = PlayedRack();
return;
}
emit gameUpdated();
unsigned currTurn = m_game->getCurrTurn();
bool isLastTurn = m_game->isLastTurn();