[gnome-chess] Fix "engine error" after user resigns before engine moves
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] Fix "engine error" after user resigns before engine moves
- Date: Sat, 5 Dec 2020 00:48:04 +0000 (UTC)
commit b8a76a263964a7c94a625efb7ac96141abf619ff
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Fri Dec 4 18:45:53 2020 -0600
Fix "engine error" after user resigns before engine moves
If the user has resigned, the engine doesn't know the game is over,
because we don't tell it. So if the user resigns immediately after
moving, and the engine has not moved yet, we need to ignore it when it
does.
Fixes #49
src/gnome-chess.vala | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index b34fd90..1e88812 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -817,6 +817,13 @@ Copyright © 2015–2016 Sahil Sareen""";
var original_game = game;
var original_state = game.current_state;
+ /* We don't inform the engine that the game has ended when the user
+ * resigns. So if the game is over, and the next game has not yet
+ * begun, we need to ignore it.
+ */
+ if (!game.is_started)
+ return;
+
if (!game.is_paused)
{
do_engine_move (move);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]