summaryrefslogtreecommitdiffstats
path: root/snake
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2001-08-31 07:17:02 +0000
committerjsm <jsm@NetBSD.org>2001-08-31 07:17:02 +0000
commita988826d5cdd58c51ed6c38a0b02d674b6631e76 (patch)
tree75724d5728ff14604a81d6e99696b3e74032ed0d /snake
parent5b23f76c7ea20190dc727fc1cbc9537ace72ff7b (diff)
downloadbsdgames-darwin-a988826d5cdd58c51ed6c38a0b02d674b6631e76.tar.gz
bsdgames-darwin-a988826d5cdd58c51ed6c38a0b02d674b6631e76.tar.zst
bsdgames-darwin-a988826d5cdd58c51ed6c38a0b02d674b6631e76.zip
Always lseek back to the beginning of the file in post(), which may be
called twice in a game if a bonus occurs. Patch from Malcolm Parsons <malcolm@ivywell.screaming.net>.
Diffstat (limited to 'snake')
-rw-r--r--snake/snake/snake.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/snake/snake/snake.c b/snake/snake/snake.c
index 908b6542..52fe4795 100644
--- a/snake/snake/snake.c
+++ b/snake/snake/snake.c
@@ -1,4 +1,4 @@
-/* $NetBSD: snake.c,v 1.16 2000/05/08 07:56:05 mycroft Exp $ */
+/* $NetBSD: snake.c,v 1.17 2001/08/31 07:17:02 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94";
#else
-__RCSID("$NetBSD: snake.c,v 1.16 2000/05/08 07:56:05 mycroft Exp $");
+__RCSID("$NetBSD: snake.c,v 1.17 2001/08/31 07:17:02 jsm Exp $");
#endif
#endif /* not lint */
@@ -541,8 +541,10 @@ post(iscore, flag)
read(rawscores, &allbwho, sizeof(short));
lseek(rawscores, uid * sizeof(short), SEEK_SET);
read(rawscores, &oldbest, sizeof(short));
- if (!flag)
+ if (!flag) {
+ lseek(rawscores, 0, SEEK_SET);
return (score > oldbest ? 1 : 0);
+ }
/* Update this jokers best */
if (score > oldbest) {