[gnome-games/gnibbles-clutter] Destroying worm properly



commit ef85dc3c8f1c7eaf1cc35939b9e248f18e824a81
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Fri Aug 14 14:05:47 2009 -0400

    Destroying worm properly

 gnibbles/gnibbles.c |    6 +-----
 gnibbles/worm.c     |    6 +++++-
 gnibbles/worm.h     |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index a08ce6a..d15ed2d 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -199,11 +199,7 @@ gnibbles_init ()
     return;
 
   gint i;
-/*
-  for (i = 0; i < properties->numworms; i++)
-    if (worms[i])
-      gnibbles_worm_destroy (worms[i]);
-*/
+
   gnibbles_scoreboard_clear (scoreboard);
 
   for (i = 0; i < properties->numworms; i++) {
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index 811a1c6..7c68f73 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -539,6 +539,10 @@ gnibbles_worm_destroy (GnibblesWorm *worm)
 {
   while (worm->list)
     gnibbles_worm_remove_actor (worm);
+
+  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));
+
+  g_free (worm);
 }
 
 void
@@ -634,7 +638,7 @@ gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
   }
 }
 
-gint
+gboolean
 gnibbles_worm_lose_life (GnibblesWorm * worm)
 {
   worm->lives--;
diff --git a/gnibbles/worm.h b/gnibbles/worm.h
index b40987c..e3d86b6 100644
--- a/gnibbles/worm.h
+++ b/gnibbles/worm.h
@@ -73,7 +73,7 @@ void gnibbles_worm_move_head (GnibblesWorm *worm);
 void gnibbles_worm_move_tail (GnibblesWorm *worm);
 void gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize);
 
-gint gnibbles_worm_lose_life (GnibblesWorm * worm);
+gboolean gnibbles_worm_lose_life (GnibblesWorm * worm);
 
 gboolean gnibbles_worm_can_move_to (GnibblesWorm * worm, gint x, gint y);
 void gnibbles_worm_position_move_head (GnibblesWorm * worm, gint *x, gint *y);



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