[gnome-games] gnibbles: Fixed bug #598664, Using safe flaot comparison



commit 271ad87eabe1f3f346b294f78b1fbf85c0c567d7
Author: Guillaume Beland <guillaume beland gmail com>
Date:   Fri Oct 16 18:58:03 2009 -0400

    gnibbles: Fixed bug #598664, Using safe flaot comparison

 gnibbles/worm.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index 22b8a0d..669d575 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -255,13 +255,13 @@ gnibbles_worm_get_tail_direction (GnibblesWorm *worm)
   xdiff = MAX (x2,x1) - MIN (x2,x1);
   ydiff = MAX (y2,y1) - MIN (y2,y1);
 
-  if (x2 > x1 && y1 == y2)
+  if (x2 > x1 && fabs (y1 - y2) <= 0)
     return xdiff > properties->tilesize ? WORMLEFT : WORMRIGHT;
-  else if (x2 < x1 && y1 == y2)
+  else if (x2 < x1 && fabs (y1 - y2) <= 0)
     return xdiff > properties->tilesize ? WORMRIGHT : WORMLEFT;
-  else if (y2 > y1 && x1 == x2)
+  else if (y2 > y1 && fabs (x1 - x2) <= 0)
     return ydiff > properties->tilesize ? WORMUP: WORMDOWN;
-  else if (y2 < y1 && x1 == x2)
+  else if (y2 < y1 && fabs (x1 - x2) <= 0)
     return ydiff > properties->tilesize ? WORMDOWN : WORMUP;
   else
     return -1;



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