1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

if the snake ran over the money, print the treasure instead of empty.

bug noticed by mlarkin
This commit is contained in:
tedu 2019-01-20 04:09:15 +00:00
parent 3b0580949c
commit e87918d773

View File

@ -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;