NetBSD Problem Report #8005

Received: (qmail 8885 invoked from network); 15 Jul 1999 18:00:39 -0000
Message-Id: <E114o87-0000CY-00@decomino.localnet>
Date: Thu, 15 Jul 1999 16:13:03 +0000
From: Joseph Myers <jsm28@cam.ac.uk>
Reply-To: Joseph Myers <jsm28@cam.ac.uk>
To: gnats-bugs@gnats.netbsd.org
Cc: Joseph Myers <jsm28@cam.ac.uk>
Subject: [PATCH] Adventure `saved' cleanup
X-Send-Pr-Version: 3.95

>Number:         8005
>Category:       bin
>Synopsis:       [PATCH] Adventure `saved' cleanup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 15 11:05:00 +0000 1999
>Closed-Date:    Fri Jul 16 01:38:39 +0000 1999
>Last-Modified:  Fri Jul 16 01:39:13 +0000 1999
>Originator:     Joseph S. Myers
>Release:        NetBSD-current of 1999-06-28
>Organization:
Trinity College, University of Cambridge, UK
>Environment:
[
System: Linux decomino 2.2.10 #1 Mon Jun 14 07:48:53 UTC 1999 i686 unknown
Architecture: i686
]
>Description:

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.

>How-To-Repeat:

>Fix:

diff -ruN netbsd/adventure/hdr.h linux/adventure/hdr.h
--- netbsd/adventure/hdr.h	Wed Feb 10 12:06:40 1999
+++ linux/adventure/hdr.h	Sat Feb 20 23:38:49 1999
@@ -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 @@
 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 -ruN netbsd/adventure/main.c linux/adventure/main.c
--- netbsd/adventure/main.c	Wed Feb 10 12:06:41 1999
+++ linux/adventure/main.c	Sat Feb 20 23:40:29 1999
@@ -451,7 +451,7 @@
 			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 -ruN netbsd/adventure/save.c linux/adventure/save.c
--- netbsd/adventure/save.c	Sun Sep 13 11:05:31 1998
+++ linux/adventure/save.c	Sat Jan  9 16:52:02 1999
@@ -95,7 +95,7 @@
 	{&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 -ruN netbsd/adventure/wizard.c linux/adventure/wizard.c
--- netbsd/adventure/wizard.c	Wed Feb 10 12:06:41 1999
+++ linux/adventure/wizard.c	Sat Feb 20 23:41:36 1999
@@ -91,7 +91,7 @@
 	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) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: hubertf 
State-Changed-When: Thu Jul 15 18:38:39 PDT 1999 
State-Changed-Why:  
Patch applied, thanks for submitting! 


- Hubert 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.