[lightsoff] Update moves' counter on keyboard move.



commit a1760ed748ef87e7842ebc2314af0daf6b6d3240
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Mar 18 05:06:24 2015 +0100

    Update moves' counter on keyboard move.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746376

 src/board-view.vala |    7 ++++++-
 src/game-view.vala  |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/board-view.vala b/src/board-view.vala
index d86e97f..ec75cba 100644
--- a/src/board-view.vala
+++ b/src/board-view.vala
@@ -183,13 +183,18 @@ public class BoardView : Clutter.Group
     {
         int x, y;
         find_light ((Light) actor, out x, out y);
+        move_to (x, y);
+    }
+
+    public void move_to (int x, int y)
+    {
         toggle_light (x, y);
         _moves += 1;
         light_toggled ();
     }
 
     // Toggle a light and those in each cardinal direction around it.
-    public void toggle_light (int x, int y, bool animate = true)
+    private void toggle_light (int x, int y, bool animate = true)
     {
         if (!playable)
             return;
diff --git a/src/game-view.vala b/src/game-view.vala
index 43da317..866b4c0 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -212,7 +212,7 @@ public class GameView : Clutter.Group
     public void activate_cursor ()
     {
         if (key_cursor_ready)
-            board_view.toggle_light (key_cursor_x, key_cursor_y);
+            board_view.move_to (key_cursor_x, key_cursor_y);
     }
 
     public void reset_game ()


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