[gnome-chess] Only display claim draw dialog if game has started



commit 9b892882b18fdd76039c53de36aebe9718cabc45
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri Jul 27 16:21:13 2018 -0500

    Only display claim draw dialog if game has started
    
    We should also probably decide whether the game has started before
    scheduling the timeout, since that's a 100ms window for everything to
    break, otherwise.
    
    Fixes #22

 src/gnome-chess.vala | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index c2716a8..6c5936d 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -1124,15 +1124,16 @@ Copyright © 2015–2016 Sahil Sareen""";
         /* Remaining work goes in a timeout to give the game widget a chance to
          * redraw first, so the pieces are shown to move before displaying the
          * claim draw dialog. */
+        var started = !starting && game.is_started;
         Timeout.add(100, () => {
-            if (game.can_claim_draw ())
+            if (game.can_claim_draw () && started)
                 present_claim_draw_dialog ();
 
             if (opponent_engine != null)
             {
                 opponent_engine.report_move (move);
 
-                if (move.piece.color != opponent.color && !starting && game.is_started)
+                if (move.piece.color != opponent.color && started)
                     opponent_engine.move ();
             }
 


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