From 9a1a69da13f46d812da562e72b0c70ce51c8d0dd Mon Sep 17 00:00:00 2001 From: Calcitem Date: Fri, 29 Jan 2021 23:09:50 +0800 Subject: [PATCH] qt: actionPiece: Support Auto Restart when game is over --- src/ui/qt/game.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ui/qt/game.cpp b/src/ui/qt/game.cpp index ffa11fc7..f3dd23bd 100644 --- a/src/ui/qt/game.cpp +++ b/src/ui/qt/game.cpp @@ -971,7 +971,21 @@ bool Game::actionPiece(QPointF p) } // If it's decided else { - pauseThreads(); + if (gameOptions.getAutoRestart()) { + saveScore(); + + gameReset(); + gameStart(); + + if (isAiPlayer[BLACK]) { + setEngine(BLACK, true); + } + if (isAiPlayer[WHITE]) { + setEngine(WHITE, true); + } + } else { + pauseThreads(); + } } }