[gnome-games/gnibbles-clutter-rebased: 105/129] Destroying worm properly



commit d244324b0c136ad84849b1977b4e2d86cc1566b6
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 d0b98a7..18334c2 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -200,11 +200,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 f224616..655b6c7 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
@@ -692,7 +696,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]