[gnome-nibbles/wip/vala] game: don't reverse the worm that ate the reverse bonus



commit 2a7d1371097cff51f592728f93bb8e11937a079a
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Tue Aug 18 14:48:26 2015 +0300

    game: don't reverse the worm that ate the reverse bonus

 src/nibbles-game.vala |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/nibbles-game.vala b/src/nibbles-game.vala
index 0d252ad..8fbda88 100644
--- a/src/nibbles-game.vala
+++ b/src/nibbles-game.vala
@@ -301,10 +301,11 @@ public class NibblesGame : Object
         }
     }
 
-    private void reverse_worms ()
+    private void reverse_worms (Worm worm)
     {
-        foreach (var worm in worms)
-            worm.reverse (walls);
+        foreach (var other_worm in worms)
+            if (worm != other_worm)
+                other_worm.reverse (walls);
     }
 
     /*\
@@ -411,7 +412,7 @@ public class NibblesGame : Object
     {
         if (bonus.fake)
         {
-            reverse_worms ();
+            reverse_worms (worm);
             return;
         }
 
@@ -438,7 +439,7 @@ public class NibblesGame : Object
                 worm.lives++;
                 break;
             case BonusType.REVERSE:
-                reverse_worms ();
+                reverse_worms (worm);
                 break;
         }
     }


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