[gnome-games] [gnibbles] Store tail direction before reversing the worm
- From: Thomas Hindoe Paaboel Andersen <thomashpa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] [gnibbles] Store tail direction before reversing the worm
- Date: Mon, 9 Aug 2010 23:18:21 +0000 (UTC)
commit c99525beee74d22c7ebf4d8daa0a70ed1197cd89
Author: Thomas Hindoe Paaboel Andersen <phomes gmail com>
Date: Tue Aug 10 01:15:36 2010 +0200
[gnibbles] Store tail direction before reversing the worm
In the shipping code the worm-> list is reversed before the data of movement of the tail is captured. This provides the wrong answer.
The patch ensures that the direction of the tail is computed before any changes are made to the current worm data. The existing code then _correctly_ reverses the old_dir because it represents the direction of motion of the tail rather than the direction in which the tail is pointing.
The direction in which the tail is pointing prior to reversal is of course the direction that we want to finally assign as the new direction of motion.
GNOME bug #619988
Patch by Felix Oxley
gnibbles/worm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index a200db9..c93d39f 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -273,10 +273,10 @@ gnibbles_worm_reverse (gpointer data)
GnibblesWorm *worm = (GnibblesWorm *) data;
gint tmp, old_dir;
- worm->list = g_list_reverse (worm->list);
-
old_dir = gnibbles_worm_get_tail_direction (worm);
+ worm->list = g_list_reverse (worm->list);
+
tmp = worm->xhead;
worm->xhead = worm->xtail;
worm->xtail = tmp;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]