summaryrefslogtreecommitdiffstats
path: root/adventure
diff options
context:
space:
mode:
authorhubertf <hubertf@NetBSD.org>1999-07-16 01:38:20 +0000
committerhubertf <hubertf@NetBSD.org>1999-07-16 01:38:20 +0000
commitae9b67f6a8d26e5428a3cbefadaa66889d4c9137 (patch)
treeaf3201abc93c14ff6a072d9986c768e94c511de8 /adventure
parentda4e0287800b9ed4057f3ba8624f9d697719e6f9 (diff)
downloadbsdgames-darwin-ae9b67f6a8d26e5428a3cbefadaa66889d4c9137.tar.gz
bsdgames-darwin-ae9b67f6a8d26e5428a3cbefadaa66889d4c9137.tar.zst
bsdgames-darwin-ae9b67f6a8d26e5428a3cbefadaa66889d4c9137.zip
This patch cleans up the handling of the variable `saved' in
adventure(6). The handling of this variable is somewhat confusing, since it is used for two different purposes (controlling the time required before a saved game can be restored, and controlling various aspects of dwarf behaviour); in fact, it is also declared twice in hdr.h. Except possibly when saving a game fails, these uses can never interfere; when used for controlling dwarf behaviour, we always have saved == -1. This can be better understood with reference to the original PDP-10 FORTRAN source (URL in patch, since hdr.h references the comments of the FORTRAN as still relevant to this version) of which the C version is a direct translation: the wrong value for `saved' meant that someone was cheating and had bypassed normal initialisation. Saving was done by halting and telling the user to save their core image, so the question of carrying on after saving failed to open the output file did not arise. This patch separates the uses of `saved' into uses of two separate variables. Closes PR 8005 by Joseph Myers <jsm28@cam.ac.uk>
Diffstat (limited to 'adventure')
-rw-r--r--adventure/hdr.h7
-rw-r--r--adventure/main.c6
-rw-r--r--adventure/save.c6
-rw-r--r--adventure/wizard.c6
4 files changed, 14 insertions, 11 deletions
diff --git a/adventure/hdr.h b/adventure/hdr.h
index 80ab5d61..68b38bf4 100644
--- a/adventure/hdr.h
+++ b/adventure/hdr.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hdr.h,v 1.6 1999/02/10 00:11:28 hubertf Exp $ */
+/* $NetBSD: hdr.h,v 1.7 1999/07/16 01:38:20 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -51,6 +51,9 @@
*
* The data file distributed with the fortran source is assumed to be called
* "glorkz" in the directory where the program is first run.
+ *
+ * The original FORTRAN version can be found at
+ * <URL:ftp://ftp.gmd.de/if-archive/games/source/advent-original.tar.gz>.
*/
/* hdr.h: included by c advent files */
@@ -71,7 +74,7 @@ int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
char *wd1, *wd2; /* the complete words */
int verb, obj, spk;
extern int blklin;
-int saved, savet, mxscor, latncy;
+int saveday, savet, mxscor, latncy;
#define SHORT 50 /* How short is a demo game? */
diff --git a/adventure/main.c b/adventure/main.c
index aa21cf8c..794e5a3f 100644
--- a/adventure/main.c
+++ b/adventure/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.13 1999/02/10 00:29:21 hubertf Exp $ */
+/* $NetBSD: main.c,v 1.14 1999/07/16 01:38:20 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
#else
-__RCSID("$NetBSD: main.c,v 1.13 1999/02/10 00:29:21 hubertf Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 1999/07/16 01:38:20 hubertf Exp $");
#endif
#endif /* not lint */
@@ -451,7 +451,7 @@ l4080:
printf(" %d minutes before continuing.", latncy);
if (!yes(200, 54, 54))
goto l2012;
- datime(&saved, &savet);
+ datime(&saveday, &savet);
ciao(); /* Do we quit? */
continue; /* Maybe not */
case 31: /* hours=8310 */
diff --git a/adventure/save.c b/adventure/save.c
index c2dc9215..9f0e8d3a 100644
--- a/adventure/save.c
+++ b/adventure/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.5 1998/09/13 00:07:24 hubertf Exp $ */
+/* $NetBSD: save.c,v 1.6 1999/07/16 01:38:20 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: save.c,v 1.5 1998/09/13 00:07:24 hubertf Exp $");
+__RCSID("$NetBSD: save.c,v 1.6 1999/07/16 01:38:20 hubertf Exp $");
#endif
#endif /* not lint */
@@ -95,7 +95,7 @@ struct savestruct save_array[] =
{&oldlc2, sizeof(oldlc2)},
{&oldloc, sizeof(oldloc)},
{&panic, sizeof(panic)},
- {&saved, sizeof(saved)},
+ {&saveday, sizeof(saveday)},
{&savet, sizeof(savet)},
{&scorng, sizeof(scorng)},
{&spk, sizeof(spk)},
diff --git a/adventure/wizard.c b/adventure/wizard.c
index 94de0530..aed2a56c 100644
--- a/adventure/wizard.c
+++ b/adventure/wizard.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wizard.c,v 1.9 1999/02/10 00:11:28 hubertf Exp $ */
+/* $NetBSD: wizard.c,v 1.10 1999/07/16 01:38:20 hubertf Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93";
#else
-__RCSID("$NetBSD: wizard.c,v 1.9 1999/02/10 00:11:28 hubertf Exp $");
+__RCSID("$NetBSD: wizard.c,v 1.10 1999/07/16 01:38:20 hubertf Exp $");
#endif
#endif /* not lint */
@@ -91,7 +91,7 @@ Start()
int d, t, delay;
datime(&d, &t);
- delay = (d - saved) * 1440 + (t - savet); /* good for about a
+ delay = (d - saveday) * 1440 + (t - savet); /* good for about a
* month */
if (delay >= latncy) {