[gnome-nibbles/arnaudb/modernize-code] Reduce even more access to a variable.



commit c2e6f42b0c70874afcb898964b6188f9905758b4
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed May 27 15:17:38 2020 +0200

    Reduce even more access to a variable.

 src/boni.vala         | 4 ++--
 src/nibbles-view.vala | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/boni.vala b/src/boni.vala
index 62a360b..61f8804 100644
--- a/src/boni.vala
+++ b/src/boni.vala
@@ -53,7 +53,7 @@ private class Boni : Object
 
     private const int MAX_BONUSES = 100;
 
-    internal signal void bonus_added ();
+    internal signal void bonus_added (Bonus bonus);
     internal signal void bonus_removed (Bonus bonus);
 
     internal void add_bonus (int[,] board, int x, int y, BonusType bonus_type, bool fake, int countdown)
@@ -67,7 +67,7 @@ private class Boni : Object
         board[x + 1, y    ] = bonus_type + 'A';
         board[x    , y + 1] = bonus_type + 'A';
         board[x + 1, y + 1] = bonus_type + 'A';
-        bonus_added ();
+        bonus_added (bonus);
         numbonuses++;
     }
 
diff --git a/src/nibbles-view.vala b/src/nibbles-view.vala
index 82ab867..9c9fa53 100644
--- a/src/nibbles-view.vala
+++ b/src/nibbles-view.vala
@@ -756,10 +756,8 @@ private class NibblesView : GtkClutter.Embed
     * * Bonuses drawing
     \*/
 
-    private void bonus_added_cb ()
+    private void bonus_added_cb (Bonus bonus)
     {
-        /* Last bonus added to the list is the one that needs a texture */
-        var bonus = game.boni.bonuses.last ();
         var actor = new BonusTexture ();
         try
         {


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