[gnome-nibbles] Don't skip last space on board when moving left/up
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nibbles] Don't skip last space on board when moving left/up
- Date: Tue, 19 Aug 2014 00:45:59 +0000 (UTC)
commit 05df04c422a1ce101daf7d3e160e349cc0a13ad0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Jul 20 12:43:07 2014 -0500
Don't skip last space on board when moving left/up
This would be a harmless, hard to notice visual glitch, if not that our
test for whether the head can move to this position (different from this
code, which controls the actual movement...) thinks this doesn't happen.
So we can end of slicing off part of an enemy worm without getting
killed.
https://bugzilla.gnome.org/show_bug.cgi?id=654072
src/worm.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/worm.c b/src/worm.c
index c9f1a37..0a576f6 100644
--- a/src/worm.c
+++ b/src/worm.c
@@ -385,12 +385,12 @@ gnibbles_worm_move_head_pointer (GnibblesWorm *worm)
break;
case WORMLEFT:
worm->xhead--;
- if (worm->xhead <= 0)
+ if (worm->xhead < 0)
worm->xhead = BOARDWIDTH - 1;
break;
case WORMUP:
worm->yhead--;
- if (worm->yhead <= 0)
+ if (worm->yhead < 0)
worm->yhead = BOARDHEIGHT - 1;
break;
default:
@@ -420,12 +420,12 @@ gnibbles_worm_move_tail_pointer (GnibblesWorm *worm)
break;
case WORMLEFT:
worm->xtail--;
- if (worm->xtail <= 0)
+ if (worm->xtail < 0)
worm->xtail = BOARDWIDTH - 1;
break;
case WORMUP:
worm->ytail--;
- if (worm->ytail <= 0)
+ if (worm->ytail < 0)
worm->ytail = BOARDHEIGHT - 1;
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]