[nethack] 03/07: Imported Upstream version 3.2.3

James Cowgill jcowgill-guest at moszumanska.debian.org
Mon Mar 7 17:52:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

jcowgill-guest pushed a commit to branch upstream
in repository nethack.

commit 996944417669cd6f1e87c8733779cdf626f76e0d
Author: James Cowgill <james410 at cowgill.org.uk>
Date:   Thu Mar 3 04:44:24 2016 +0000

    Imported Upstream version 3.2.3
---
 README                 |  2 +-
 include/patchlevel.h   | 26 ++++++++++++++++++++------
 src/end.c              |  3 +++
 src/hacklib.c          | 35 +++++++++++++++++++++++++++++++++--
 src/mail.c             |  7 +++++--
 src/mkmaze.c           |  5 ++++-
 src/music.c            |  2 ++
 src/pager.c            |  2 +-
 src/pray.c             |  3 ++-
 src/sp_lev.c           | 23 ++++++++++++++++++++++-
 src/topten.c           | 48 +++++++++++++++---------------------------------
 src/trap.c             |  3 +++
 src/version.c          | 26 +++++++++++++++++---------
 sys/mac/macwin.c       |  4 ++++
 sys/msdos/Makefile.GCC |  2 +-
 15 files changed, 133 insertions(+), 58 deletions(-)

diff --git a/README b/README
index 2df3e38..24cb267 100644
--- a/README
+++ b/README
@@ -170,7 +170,7 @@ Please read items (1), (2) and (3) BEFORE doing anything with your new code.
 If you have problems building the game, or you find bugs in it, the
 development team may be reached as
 
-                    nethack-bugs at linc.cis.upenn.edu
+                    nethack-bugs at nethack.org
 
 Please be sure to include your machine type, OS, and patchlevel.
 
diff --git a/include/patchlevel.h b/include/patchlevel.h
index b8e532b..b309021 100644
--- a/include/patchlevel.h
+++ b/include/patchlevel.h
@@ -1,14 +1,14 @@
-/*	SCCS Id: @(#)patchlevel.h	3.2	96/11/19	*/
+/*	SCCS Id: @(#)patchlevel.h	3.2	99/12/10	*/
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
-/* NetHack 3.2.2 */
+/* NetHack 3.2.3 */
 #define VERSION_MAJOR	3
 #define VERSION_MINOR	2
 /*
  * PATCHLEVEL is updated for each release.
  */
-#define PATCHLEVEL	2
+#define PATCHLEVEL	3
 /*
  * Incrementing EDITLEVEL can be used to force invalidation of old bones
  * and save files.
@@ -16,7 +16,7 @@
 #define EDITLEVEL	0
 
 #define COPYRIGHT_BANNER_A \
-"NetHack, Copyright 1985-1996"
+"NetHack, Copyright 1985-1999"
 
 #define COPYRIGHT_BANNER_B \
 "         By Stichting Mathematisch Centrum and M. Stephenson."
@@ -24,7 +24,7 @@
 #define COPYRIGHT_BANNER_C \
 "         See license for details."
 
-#if 0
+#if 1
 /*
  * If two successive patchlevels have compatible data files (fat chance),
  * defining this with the value of the older one will allow its bones and
@@ -38,7 +38,21 @@
 #endif
 
 /*****************************************************************************/
-/* Version 3.2.2 */
+/* Version 3.2.3 */
+
+/*  Patch 3, December 10, 1999
+ *  Released simultaneously with 3.3.0 for the benefit of
+ *  ports and platforms that were unable to get working
+ *  versions of 3.3.0 ready prior to the year 2000. It
+ *  consisted of just a few bug fixes and offered no new
+ *  functionality changes over 3.2.2.
+ *  
+ *  Y2K fix: use 4 digit year values for the dates in the score file
+ *  updated COPYRIGHT_BANNER_A to reflect year of release
+ *  Fatal Mac bug removed
+ *  DOS Makefile problem removed
+ *  several bugs that could potentially trigger crashes removed
+ */
 
 /*  Patch 2, December 10, 1996
  *  fix the `recover' utility
diff --git a/src/end.c b/src/end.c
index 8166ae0..b1fe3fb 100644
--- a/src/end.c
+++ b/src/end.c
@@ -535,9 +535,12 @@ die:
 
 	/* clean up unneeded windows */
 	if (have_windows) {
+	    wait_synch();
+	    display_nhwindow(WIN_MESSAGE, TRUE);
 	    destroy_nhwindow(WIN_MAP);
 	    destroy_nhwindow(WIN_STATUS);
 	    destroy_nhwindow(WIN_MESSAGE);
+	    WIN_MESSAGE = WIN_STATUS = WIN_MAP = WIN_ERR;
 
 	    if(!done_stopprint || flags.tombstone)
 		endwin = create_nhwindow(NHW_TEXT);
diff --git a/src/hacklib.c b/src/hacklib.c
index 23e609a..c243dd0 100644
--- a/src/hacklib.c
+++ b/src/hacklib.c
@@ -35,6 +35,7 @@ NetHack, except that rounddiv may call panic().
 	void		setrandom	(void)
 	int		getyear		(void)
 	char *		yymmdd		(time_t)
+	long		yyyymmdd	(time_t)
 	int		phase_of_the_moon	(void)
 	boolean		friday_13th	(void)
 	int		night		(void)
@@ -395,7 +396,7 @@ strstri(str, sub)	/* case insensitive substring search */
  *
  * The time is used for:
  *	- seed for rand()
- *	- year on tombstone and yymmdd in record file
+ *	- year on tombstone and yyyymmdd in record file
  *	- phase of the moon (various monsters react to NEW_MOON or FULL_MOON)
  *	- night and midnight (the undead are dangerous at midnight)
  *	- determination of what files are "very old"
@@ -457,11 +458,12 @@ getyear()
 	return(1900 + getlt()->tm_year);
 }
 
+/* This routine is no longer used since in 2000 it will yield "100mmdd". */
 char *
 yymmdd(date)
 time_t date;
 {
-	Static char datestr[7];
+	Static char datestr[10];
 	struct tm *lt;
 
 	if (date == 0)
@@ -478,6 +480,35 @@ time_t date;
 	return(datestr);
 }
 
+long
+yyyymmdd(date)
+time_t date;
+{
+	long datenum;
+	struct tm *lt;
+
+	if (date == 0)
+		lt = getlt();
+	else
+#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) || defined(BSD)
+		lt = localtime((long *)(&date));
+#else
+		lt = localtime(&date);
+#endif
+
+	/* just in case somebody's localtime supplies (year % 100)
+	   rather than the expected (year - 1900) */
+	if (lt->tm_year < 70)
+	    datenum = (long)lt->tm_year + 2000L;
+	else
+	    datenum = (long)lt->tm_year + 1900L;
+	/* yyyy --> yyyymm */
+	datenum = datenum * 100L + (long)(lt->tm_mon + 1);
+	/* yyyymm --> yyyymmdd */
+	datenum = datenum * 100L + (long)lt->tm_mday;
+	return datenum;
+}
+
 /*
  * moon period = 29.53058 days ~= 30, year = 365.2422 days
  * days moon phase advances on first day of year compared to preceding year
diff --git a/src/mail.c b/src/mail.c
index 991f738..cb9e72a 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -434,14 +434,17 @@ struct obj *otmp;
 {
 	char *junk[]={
 	"Please disregard previous letter.",
-	"Welcome to NetHack 3.2.2!",
+	"Welcome to NetHack 3.2.3!",
 #ifdef AMIGA
 	"Only Amiga makes it possible.",
 	"CATS have all the answers.",
 #endif
-	"Report bugs to nethack-bugs at linc.cis.upenn.edu"
+	"Report bugs to <nethack-bugs at nethack.org>"
 	};
 
+    if (Blind)
+	pline("Unfortunately you cannot see what it says.");
+    else
 	pline("It reads:  \"%s\"", junk[rn2(SIZE(junk))]);
 }
 
diff --git a/src/mkmaze.c b/src/mkmaze.c
index cfa8c09..1a320ea 100644
--- a/src/mkmaze.c
+++ b/src/mkmaze.c
@@ -919,6 +919,8 @@ movebubbles()
 	if (!wportal) set_wportal();
 
 	vision_recalc(2);
+	/* keep attached ball&chain separate from bubble objects */
+	if (Punished) unplacebc();
 
 	/*
 	 * Pick up everything inside of a bubble then fill all bubble
@@ -1021,6 +1023,8 @@ movebubbles()
 			    FALSE);
 	}
 
+	/* put attached ball&chain back */
+	if (Punished) placebc();
 	vision_full_recalc = 1;
 }
 
@@ -1321,7 +1325,6 @@ register boolean ini;
 		    if (MON_AT(cons->x, cons->y)) {
 				mnexto(m_at(cons->x,cons->y));
 			}
-		    if (Punished) placebc();	/* do this for now */
 		    break;
 		}
 
diff --git a/src/music.c b/src/music.c
index 8329cfd..0888537 100644
--- a/src/music.c
+++ b/src/music.c
@@ -244,6 +244,8 @@ int force;
 			goto do_pit;
 #endif
 		  case ALTAR :
+			if (Is_astralevel(&u.uz) || Is_sanctum(&u.uz)) break;
+
 			if (cansee(x,y))
 				pline_The("altar falls into a chasm.");
 			goto do_pit;
diff --git a/src/pager.c b/src/pager.c
index 1d323f4..9d736a6 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -507,7 +507,7 @@ do_look(quick)
 
 	/* Finally, print out our explanation. */
 	if (found) {
-	    pline(out_str);
+	    pline("%s", out_str);
 	    /* check the data file for information about this thing */
 	    if (found == 1 && !quick && flags.help) {
 		char temp_buf[BUFSZ];
diff --git a/src/pray.c b/src/pray.c
index ebdb1b1..9600560 100644
--- a/src/pray.c
+++ b/src/pray.c
@@ -248,7 +248,8 @@ register int trouble;
 		    break;
 	    case TROUBLE_STUCK_IN_WALL:
 		    Your("surroundings change.");
-		    tele();
+		    /* no control, but works on no-teleport levels */
+		    (void) safe_teleds();
 		    break;
 	    case TROUBLE_CURSED_LEVITATION:
 		    if (uarmf && uarmf->otyp==LEVITATION_BOOTS
diff --git a/src/sp_lev.c b/src/sp_lev.c
index 4824f54..a9e420e 100644
--- a/src/sp_lev.c
+++ b/src/sp_lev.c
@@ -739,6 +739,7 @@ struct mkroom	*croom;
     schar x, y;
     char class;
     aligntyp amask;
+    coord cc;
     struct permonst *pm;
 
     if (rn2(100) < m->chance) {
@@ -785,7 +786,9 @@ struct mkroom	*croom;
 	    else
 		get_location(&x, &y, DRY|WET);
 	}
-
+	/* try to find a close place if someone else is already there */
+	if (MON_AT(x,y) && enexto(&cc, x, y, pm))
+	    x = cc.x,  y = cc.y;
 
 	if(m->align != -12)
 	    mtmp = mk_roamer(pm, Amask2align(amask), x, y, m->peaceful);
@@ -1058,6 +1061,7 @@ create_altar(a, croom)
 	schar		sproom,x,y;
 	aligntyp	amask;
 	boolean		croom_is_temple = TRUE;
+	int oldtyp; 
 
 	x = a->x; y = a->y;
 
@@ -1073,6 +1077,11 @@ create_altar(a, croom)
 		croom_is_temple = FALSE;
 	}
 
+	/* check for existing features */
+	oldtyp = levl[x][y].typ;
+	if (oldtyp == STAIRS || oldtyp == LADDER)
+	    return;
+
 	a->x = x;
 	a->y = y;
 
@@ -1092,6 +1101,11 @@ create_altar(a, croom)
 
 	if (a->shrine == -11) a->shrine = rn2(1);  /* handle random case */
 
+	if (oldtyp == FOUNTAIN)
+	    level.flags.nfountains--;
+	else if (oldtyp == SINK)
+	    level.flags.nsinks--;
+
 	if (!croom_is_temple || !a->shrine) return;
 
 	if (a->shrine) {	/* Is it a shrine  or sanctum? */
@@ -1150,6 +1164,13 @@ int		typ;
 	} else {
 	    get_location(&x, &y, DRY);
 	}
+	/* Don't cover up an existing feature (particularly randomly
+	   placed stairs).  However, if the _same_ feature is already
+	   here, it came from the map drawing and we still need to
+	   update the special counters. */
+	if (IS_FURNITURE(levl[x][y].typ) && levl[x][y].typ != typ)
+	    return;
+
 	levl[x][y].typ = typ;
 	if (typ == FOUNTAIN)
 	    level.flags.nfountains++;
diff --git a/src/topten.c b/src/topten.c
index 1ee73eb..c799594 100644
--- a/src/topten.c
+++ b/src/topten.c
@@ -48,7 +48,7 @@ struct toptenentry {
 	int deathdnum, deathlev;
 	int maxlvl, hp, maxhp, deaths;
 	int ver_major, ver_minor, patchlevel;
-	char deathdate[8], birthdate[8]; /* see readentry about size */
+	long deathdate, birthdate;
 	int uid;
 	char plchar;
 	char sex;
@@ -126,35 +126,11 @@ FILE *rfile;
 struct toptenentry *tt;
 {
 #ifdef NO_SCAN_BRACK
-	static char *fmt = "%d %d %d %ld %d %d %d %d %d %d %6s %6s %d%*c%c%c %s %s%*c";
+	static char *fmt = "%d %d %d %ld %d %d %d %d %d %d %ld %ld %d%*c%c%c %s %s%*c";
 #else
-	static char *fmt = "%d.%d.%d %ld %d %d %d %d %d %d %6s %6s %d %c%c %[^,],%[^\n]%*c";
+	static char *fmt = "%d.%d.%d %ld %d %d %d %d %d %d %ld %ld %d %c%c %[^,],%[^\n]%*c";
 #endif
 
-#ifdef __BEOS__
-	/*
-	Test for a bug in Be's *scanf functions.  This exists in at least
-	versions DR8.2 and earlier.  We should eventually be able to
-	remove this special code..
-
-	The bug is that a read of a sized string field, e.g. %6s, leaves
-	the last character of the string to be read again.  The work-round
-	is to increase the read size by 1.  This means that deathdate and
-	birthdate need a size of 8 (7 chars + 1 NULL) instead of a size
-	7 (6 chars + 1 NULL).
-	*/
-	static boolean tested_scanf_bug = FALSE;
-
-	if (!tested_scanf_bug) {
-		char s1[16], s2[16];
-		
-		tested_scanf_bug  = TRUE;
-		(void) sscanf("123456 789012", "%6s %6s", s1, s2);
-		if (strcmp(s2, "789012") != 0)
-			fmt = "%d.%d.%d %ld %d %d %d %d %d %d %7s %7s %d %c%c %[^,],%[^\n]%*c";
-	}
-#endif /* __BEOS__ */ 
-
 #ifdef UPDATE_RECORD_IN_PLACE
 	/* note: fscanf() below must read the record's terminating newline */
 	final_fpos = tt->fpos = ftell(rfile);
@@ -164,7 +140,7 @@ struct toptenentry *tt;
 			&tt->ver_major, &tt->ver_minor, &tt->patchlevel,
 			&tt->points, &tt->deathdnum, &tt->deathlev,
 			&tt->maxlvl, &tt->hp, &tt->maxhp, &tt->deaths,
-			tt->deathdate, tt->birthdate,
+			&tt->deathdate, &tt->birthdate,
 			&tt->uid, &tt->plchar, &tt->sex,
 			tt->name, tt->death) != TTFIELDS)
 #undef TTFIELDS
@@ -177,6 +153,12 @@ struct toptenentry *tt;
 		}
 #endif
 	}
+
+	/* check old score entries for Y2K problem and fix whenever found */
+	if (tt->points > 0) {
+		if (tt->birthdate < 19000000L) tt->birthdate += 19000000L;
+		if (tt->deathdate < 19000000L) tt->deathdate += 19000000L;
+	}
 }
 
 static void
@@ -187,9 +169,9 @@ struct toptenentry *tt;
 #ifdef NO_SCAN_BRACK
 	nsb_mung_line(tt->name);
 	nsb_mung_line(tt->death);
-	(void) fprintf(rfile,"%d %d %d %ld %d %d %d %d %d %d %6s %6s %d %c%c %s %s\n",
+	(void) fprintf(rfile,"%d %d %d %ld %d %d %d %d %d %d %ld %ld %d %c%c %s %s\n",
 #else
-	(void) fprintf(rfile,"%d.%d.%d %ld %d %d %d %d %d %d %6s %6s %d %c%c %s,%s\n",
+	(void) fprintf(rfile,"%d.%d.%d %ld %d %d %d %d %d %d %ld %ld %d %c%c %s,%s\n",
 #endif
 		tt->ver_major, tt->ver_minor, tt->patchlevel,
 		tt->points, tt->deathdnum, tt->deathlev,
@@ -295,8 +277,8 @@ int how;
 			(void) strncat(t0->death, killer, DTHSZ);
 			break;
 	}
-	Strcpy(t0->birthdate, yymmdd(u.ubirthday));
-	Strcpy(t0->deathdate, yymmdd(0L));
+	t0->birthdate = yyyymmdd(u.ubirthday);
+	t0->deathdate = yyyymmdd((time_t)0L);
 	t0->tt_next = 0;
 #ifdef UPDATE_RECORD_IN_PLACE
 	t0->fpos = -1L;
@@ -476,7 +458,7 @@ int how;
 	    t1->uid = t1->deathdnum = t1->deathlev = 0;
 	    t1->maxlvl = t1->hp = t1->maxhp = t1->deaths = 0;
 	    t1->plchar = t1->sex = '-';
-	    Strcpy(t1->birthdate, strcpy(t1->deathdate, yymmdd(0L)));
+	    t1->birthdate = t1->deathdate = yyyymmdd((time_t)0L);
 	    Strcpy(t1->name, "@");
 	    Strcpy(t1->death, "<eod>\n");
 	    writeentry(rfile, t1);
diff --git a/src/trap.c b/src/trap.c
index 53c30af..f8df8df 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -1793,6 +1793,9 @@ boolean *lostsome;
 {
 	int invc = inv_cnt();
 
+	/* [TODO: drop u.ugold separately or insert it into inventory chain] */
+	if (invc == 0) return FALSE;	/* nothing to drop */
+
 	while (near_capacity() > (Punished ? UNENCUMBERED : SLT_ENCUMBER)) {
 		register struct obj *obj, *otmp = (struct obj *)0;
 		register int i = rn2(invc);
diff --git a/src/version.c b/src/version.c
index d4016f7..88da82b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -1,4 +1,4 @@
-/*	SCCS Id: @(#)version.c	3.2	96/06/22	*/
+/*	SCCS Id: @(#)version.c	3.2	99/05/19	*/
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -82,16 +82,24 @@ uptodate(fd, name)
 int fd;
 const char *name;
 {
-	struct version_info vers_info;
-	boolean verbose = name ? TRUE : FALSE;
+    int rlen;
+    struct version_info vers_info;
+    boolean verbose = name ? TRUE : FALSE;
 
-	(void) read(fd, (genericptr_t) &vers_info, sizeof vers_info);
-	minit();	/* ZEROCOMP */
-	if (!check_version(&vers_info, name, verbose)) {
-		if (verbose) wait_synch();
-		return FALSE;
+    rlen = read(fd, (genericptr_t) &vers_info, sizeof vers_info);
+    minit();		/* ZEROCOMP */
+    if (rlen == 0) {
+	if (verbose) {
+	    pline("File \"%s\" is empty?", name);
+	    wait_synch();
 	}
-	return TRUE;
+	return FALSE;
+    }
+    if (!check_version(&vers_info, name, verbose)) {
+	if (verbose) wait_synch();
+	return FALSE;
+    }
+    return TRUE;
 }
 
 void
diff --git a/sys/mac/macwin.c b/sys/mac/macwin.c
index fc0aed0..cdc7d32 100644
--- a/sys/mac/macwin.c
+++ b/sys/mac/macwin.c
@@ -2389,6 +2389,10 @@ mac_get_nh_event( void )
 {
 	EventRecord anEvent ;
 
+	/* KMH -- Don't proceed if the window system isn't set up */
+	if (!iflags.window_inited)
+		return;
+
 	if ( ( inSelect == WIN_ERR && iflags . window_inited && ! in_topl_mode ( ) )
 		 == mBarDimmed )
 		if ( mBarDimmed ) {
diff --git a/sys/msdos/Makefile.GCC b/sys/msdos/Makefile.GCC
index f43e0b5..3783660 100644
--- a/sys/msdos/Makefile.GCC
+++ b/sys/msdos/Makefile.GCC
@@ -754,7 +754,7 @@ viewtib.o: viewtib.c
 alloc.o: $(CONFIG_H)	 alloc.c
 	$(CC) $(CFLAGS) -oalloc.o alloc.c
 
-drawing.o: $(CONFIG_H) drawing.c pcvideo.h
+drawing.o: $(CONFIG_H) drawing.c $(INCL)\pcvideo.h
 	$(CC) $(CFLAGS) -odrawing.o drawing.c
 
 decl.o: $(CONFIG_H) decl.c

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/nethack.git



More information about the Pkg-games-commits mailing list