[gnome-games] chess: Fix non-displaying move hints



commit 7d6888f4d5f076fede37f086f3605920af6b9f6f
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Mar 9 11:38:38 2011 +1100

    chess: Fix non-displaying move hints

 glchess/src/chess-scene.vala |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/glchess/src/chess-scene.vala b/glchess/src/chess-scene.vala
index 0005d50..7192215 100644
--- a/glchess/src/chess-scene.vala
+++ b/glchess/src/chess-scene.vala
@@ -230,6 +230,12 @@ public class ChessScene : Object
         {
             for (int file = 0; file < 8; file++)
             {
+                var can_move = false;
+                if (selected_rank >= 0 && move_number == -1 &&
+                    game.current_player.move_with_coords (selected_rank, selected_file, rank, file, false))
+                    can_move = true;
+                _can_move[rank * 8 + file] = can_move;
+
                 var piece = game.get_piece (rank, file, move_number);
                 if (piece == null)
                     continue;
@@ -239,6 +245,7 @@ public class ChessScene : Object
                     model = new ChessModel (piece, (double) file, (double) rank);
                     board_changed = true;
                 }
+                model.under_threat = can_move;
 
                 if (model.move_to ((double) file, (double) rank))
                 {
@@ -246,18 +253,6 @@ public class ChessScene : Object
                     need_animation = true;
                 }
 
-                if (selected_rank > 0 && move_number == -1 &&
-                    game.current_player.move_with_coords (selected_rank, selected_file, rank, file, false))
-                {
-                    model.under_threat = true;
-                    _can_move[rank * 8 + file] = true;
-                }
-                else
-                {
-                    model.under_threat = false;
-                    _can_move[rank * 8 + file] = false;
-                }
-
                 if (move_number == -1 && rank == selected_rank && file == selected_file)
                     model.is_selected = true;
                 else



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