[iagno] Allow to see end position.



commit c16a81aae98e80fc9882fc110085709aabf2a110
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Feb 15 20:48:11 2019 +0100

    Allow to see end position.
    
    A minor change of behaviour,
    even if we're in freeze. The
    game ends with an animation,
    for displaying the number of
    tiles players have. A player
    has two seconds to see final
    position; that's not enough,
    if the player wants to learn
    by observing the game. Allow
    reaching the end position by
    the first call to an "undo".

 src/game-view.vala | 12 ++++++++++++
 src/iagno.vala     |  6 ++++++
 2 files changed, 18 insertions(+)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index 32e2be5..b358ab9 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -552,6 +552,18 @@ private class GameView : Gtk.DrawingArea
         }
     }
 
+    internal bool undo_final_animation ()
+    {
+        if (!flip_final_result_now)
+            return false;
+
+        for (uint8 x = 0; x < game.size; x++)
+            for (uint8 y = 0; y < game.size; y++)
+                update_square (x, y);
+
+        return true;
+    }
+
     /*\
     * * user actions
     \*/
diff --git a/src/iagno.vala b/src/iagno.vala
index 7debeef..76d8432 100644
--- a/src/iagno.vala
+++ b/src/iagno.vala
@@ -403,6 +403,12 @@ private class Iagno : Gtk.Application
     private void undo_cb ()
         requires (game_is_set)
     {
+        if (view.undo_final_animation ())
+        {
+            play_sound (Sound.GAMEOVER);
+            return;
+        }
+
         if (computer == null)
         {
             game.undo (1);


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