[gnome-chess/gnome-3-30] Fix draws claimed by engines



commit caa8dfae44fb80faec6699cbf73a0d74f1a78bf6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Jan 27 11:22:50 2019 -0600

    Fix draws claimed by engines
    
    Currently when the engine claims a draw, we check to see if it's
    possible to claim a draw. If so, we do nothing and the game stalls
    forever while GNOME Chess claims the engine is thinking. If not, the
    game ends in a bug (as it should).
    
    We're missing the call to actually end the game in a draw. Fix it.
    
    Fixes #32

 src/gnome-chess.vala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 0f60d80..0f1ff2e 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -787,7 +787,9 @@ Copyright © 2015–2016 Sahil Sareen""";
 
     private void engine_claim_draw_cb (ChessEngine engine)
     {
-        if (!game.can_claim_draw ())
+        if (game.can_claim_draw ())
+            opponent.claim_draw ();
+        else
             game.stop (ChessResult.BUG, ChessRule.BUG);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]