Commit 70d4aa03 authored by Michael Catanzaro's avatar Michael Catanzaro

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
parent 984d3b20
......@@ -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)
......
......@@ -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 ();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment