[gnome-chess] Disable selecting pieces after the game is over



commit 51b6321514b308d9ff559b63ca6b57a261a99d35
Author: Sahil Sareen <sahil sareen hotmail com>
Date:   Sat Dec 5 18:46:50 2015 +0530

    Disable selecting pieces after the game is over
    
      - Add a check in button_press_event
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758775

 src/chess-view.vala |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/chess-view.vala b/src/chess-view.vala
index 655bae4..ec33bbe 100644
--- a/src/chess-view.vala
+++ b/src/chess-view.vala
@@ -276,6 +276,10 @@ public class ChessView : Gtk.DrawingArea
         if (scene.game == null || event.button != 1 || scene.game.should_show_paused_overlay)
             return false;
 
+        // If the game is over, disable selection of pieces
+        if (scene.game.result != ChessResult.IN_PROGRESS)
+            return false;
+
         int file = (int) Math.floor ((event.x - 0.5 * get_allocated_width () + square_size * 4) / 
square_size);
         int rank = 7 - (int) Math.floor ((event.y - 0.5 * get_allocated_height () + square_size * 4) / 
square_size);
 


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