Commit 0e881b97 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Fix AI playing out of turn when restarting game while AI is playing

BUGS: 335332
parent b0fdaa3a
......@@ -278,6 +278,11 @@ void KSquaresWindow::playerTakeTurn(KSquaresPlayer *currentPlayer)
// testing only
void KSquaresWindow::aiChooseLine()
{
// This can happen when we start a new game and the ai was playing, since we have a
// 200 ms singleShot timer just above, the game may have changed since the timer was shot
if (sGame->currentPlayer()->isHuman())
return;
aiController ai(sGame->currentPlayerId(), sGame->lines(), sGame->squares(), sGame->boardWidth(), sGame->boardHeight());
sGame->addLineToIndex(ai.chooseLine());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment