[gnome-nibbles] Fix sound played when eating a bonus



commit 70d4aa03c5836f38f8d8a63105ab0447cf7ac523
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Feb 18 18:54:22 2016 -0600

    Fix sound played when eating a bonus
    
    Should be based on the bonus that was eaten, not the last bonus added to
    the board.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762293

 src/nibbles-game.vala |    4 ++--
 src/nibbles-view.vala |    6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/nibbles-game.vala b/src/nibbles-game.vala
index 86adfd1..7fe8fd8 100644
--- a/src/nibbles-game.vala
+++ b/src/nibbles-game.vala
@@ -78,7 +78,7 @@ public class NibblesGame : Object
     public bool fakes { get; set; }
 
     public signal void worm_moved (Worm worm);
-    public signal void bonus_applied (Worm worm);
+    public signal void bonus_applied (Bonus bonus, Worm worm);
     public signal void log_score (int score, int level_reached);
     public signal void animate_end_game ();
     public signal void level_completed ();
@@ -466,7 +466,7 @@ public class NibblesGame : Object
         if (bonus == null)
             return;
         apply_bonus (bonus, worm);
-        bonus_applied (worm);
+        bonus_applied (bonus, worm);
 
         if (board[worm.head.x, worm.head.y] == BonusType.REGULAR + 'A'
             && !bonus.fake)
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index b9d82d4..f1acc6f 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -812,7 +812,7 @@ public class NibblesView : GtkClutter.Embed
         level.remove_child (bonus_actor);
     }
 
-    private void bonus_applied_cb (Worm worm)
+    private void bonus_applied_cb (Bonus bonus, Worm worm)
     {
         var actors = worm_actors.get (worm);
         var actor = actors.last_child;
@@ -824,8 +824,6 @@ public class NibblesView : GtkClutter.Embed
         actor.set_pivot_point (0.5f, 0.5f);
         actor.restore_easing_state ();
 
-        /* Play sound based on applied bonus */
-        var bonus = game.boni.bonuses.last ();
         switch (bonus.type)
         {
             case BonusType.REGULAR:
@@ -844,7 +842,7 @@ public class NibblesView : GtkClutter.Embed
                 play_sound ("reverse");
                 break;
             default:
-                break;
+                assert_not_reached ();
         }
     }
 


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