[gnome-chess] Fix draws claimed by engines



commit a1be44a0ed69a6c1c3924602b9cb8b003da73c33
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 3a04d08..8f04aad 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -789,7 +789,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]