summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2019-01-20 04:09:15 +0000
committertedu <tedu@openbsd.org>2019-01-20 04:09:15 +0000
commite87918d773a40272f3e61729a4d0d3d9fb86e24f (patch)
tree684459f6d5ebcb701fc904d593388c1aae28e7a2
parentuse standard headers for siphash (diff)
downloadwireguard-openbsd-e87918d773a40272f3e61729a4d0d3d9fb86e24f.tar.xz
wireguard-openbsd-e87918d773a40272f3e61729a4d0d3d9fb86e24f.zip
if the snake ran over the money, print the treasure instead of empty.
bug noticed by mlarkin
-rw-r--r--games/snake/snake.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/games/snake/snake.c b/games/snake/snake.c
index a0c8aac71c9..143da3d336b 100644
--- a/games/snake/snake.c
+++ b/games/snake/snake.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snake.c,v 1.29 2018/08/24 11:14:49 mestre Exp $ */
+/* $OpenBSD: snake.c,v 1.30 2019/01/20 04:09:15 tedu Exp $ */
/* $NetBSD: snake.c,v 1.8 1995/04/29 00:06:41 mycroft Exp $ */
/*
@@ -844,8 +844,12 @@ pushsnake(void)
for (i = 4; i >= 0; i--)
if (same(&snake[i], &snake[5]))
issame++;
- if (!issame)
- pchar(&snake[5], ' ');
+ if (!issame) {
+ char sp = ' ';
+ if (same(&money, &snake[5]))
+ sp = TREASURE;
+ pchar(&snake[5], sp);
+ }
/* Need the following to catch you if you step on the snake's tail */
tmp.col = snake[5].col;
tmp.line = snake[5].line;