From 3ce4fe41803104ab971ae50936f84d050e6ad280 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 9 Dec 2015 05:56:40 -0800 Subject: [PATCH 01/10] fix #H4026 - silly plural bug When a stack of corpses gets zapped by undead turning, the message was "The corpses glows iridescently." Change it to "One of the corpses glows iridescently." since only one of the stack gets revived. --- src/zap.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/zap.c b/src/zap.c index 474f19563..26ddd757d 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1447987787 2015/11/20 02:49:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.236 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1449669396 2015/12/09 13:56:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.238 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -758,15 +758,22 @@ boolean by_hero; if (costly_spot(x, y)) shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)); - if (cansee(x, y)) - pline( - "%s glows iridescently.", - upstart(corpse_xname(corpse, (const char *) 0, CXN_PFX_THE))); - else if (shkp) + if (cansee(x, y)) { + char buf[BUFSZ]; + unsigned pfx = CXN_PFX_THE; + + Strcpy(buf, (corpse->quan > 1L) ? "one of " : ""); + if (carried(corpse) && !corpse->unpaid) { + Strcat(buf, "your "); + pfx = CXN_NO_PFX; + } + Strcat(buf, corpse_xname(corpse, (const char *) 0, pfx)); + pline("%s glows iridescently.", upstart(buf)); + } else if (shkp) { /* need some prior description of the corpse since stolen_value() will refer to the object as "it" */ pline("A corpse is resuscitated."); - + } /* don't charge for shopkeeper's own corpse if we just revived him */ if (shkp && mtmp != shkp) (void) stolen_value(corpse, x, y, (boolean) shkp->mpeaceful, From ea2f3225cc1451373193783ddc9417cea6a56e0f Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 9 Dec 2015 17:44:15 +0200 Subject: [PATCH 02/10] Fix history stating 3.5 Amiga and Atari ports existed --- dat/history | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dat/history b/dat/history index 6095a1ef2..fe8bee20c 100644 --- a/dat/history +++ b/dat/history @@ -145,9 +145,9 @@ contributed a Windows CE port for 3.4.1. Ron Van Iwaarden maintained 3.4 for OS/2. Janne Salmijarvi and Teemu Suikki maintained and enhanced the -Amiga port of 3.5 after Janne Salmijarvi resurrected it for 3.3.1. +Amiga port of 3.4 after Janne Salmijarvi resurrected it for 3.3.1. -Christian `Marvin' Bressler maintained 3.5 for the Atari after he +Christian `Marvin' Bressler maintained 3.4 for the Atari after he resurrected it for 3.3.1. The release of NetHack 3.4.3 in December 2003 marked the beginning of a From 43550bee53b10318fd71630bffe5f02843c06bee Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 9 Dec 2015 22:27:22 +0200 Subject: [PATCH 03/10] Allow unlimited number of players This is important for public servers. Setting the MAXPLAYERS sysconf value to 0 (or commenting it out) constructs the lock files with the player UID and player name, so each player may have one game at a time. --- src/files.c | 2 +- sys/unix/sysconf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 1b74a56b4..7699ee1cc 100644 --- a/src/files.c +++ b/src/files.c @@ -2279,7 +2279,7 @@ int src; } else if (src == SET_IN_SYS && match_varname(buf, "MAXPLAYERS", 10)) { n = atoi(bufp); /* XXX to get more than 25, need to rewrite all lock code */ - if (n < 1 || n > 25) { + if (n < 0 || n > 25) { raw_printf("Illegal value in MAXPLAYERS (maximum is 25)."); return 0; } diff --git a/sys/unix/sysconf b/sys/unix/sysconf index 83d33d466..1bed4487f 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -31,6 +31,12 @@ EXPLORERS=* #SHELLERS= # Limit the number of simultaneous games (see also nethack.sh). +# Valid values are 0-25. +# Commenting this out or setting the value to 0 constructs lock files +# with UID and username, so each user may have one game at a time, but +# number of different players is not limited. +# Setting this to any other value constructs the lock files with +# letter and "lock" (eg. alock, block, ...) MAXPLAYERS=10 # If not null, added to string "To get local support, " in the support From de4e4bb6016669e6cc94842ef1297667c424d213 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 10 Dec 2015 00:06:52 -0800 Subject: [PATCH 04/10] doc/fixes36.1 - get it started... --- doc/fixes36.1 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 doc/fixes36.1 diff --git a/doc/fixes36.1 b/doc/fixes36.1 new file mode 100644 index 000000000..54de20e75 --- /dev/null +++ b/doc/fixes36.1 @@ -0,0 +1,35 @@ +$NHDT-Branch$:$NHDT-Revision$ $NHDT-Date$ + +General Fixes and Modified Features +----------------------------------- +doc/*.6 man pages and corresponding doc/*.txt text copies were out of date +data.base entry for "lava" had wrong first name for Don Woods' attribution +cursed genocide of "none" sent in monsters, but "that's enough tries" didn't + + +Platform- and/or Interface-Specific Fixes +----------------------------------------- +unix/X11: in top level Makefile, some commented out definitions of VARDATND + misspelled pilemark.xbm (as pilemark.xpm) +win32gui: missing sys_early_init() call could result in "rnd(0) attempted" +MacOSX: initial binary release was built from out of date source code that + had 'BETA' and 'DEBUG' inappropriately enabled +X11: core bug for '`' (backtick) command was only noticed by X11 interface, + which issued impossible message "add_menu: called before start_menu" + + +General New Features +-------------------- + + +Platform- and/or Interface-Specific New Features +------------------------------------------------ + + +NetHack Community Patches (or Variation) Included +------------------------------------------------- + + +Code Cleanup and Reorganization +------------------------------- + From f4a6ccf3f060ff3a58c1b6e5238c1872774efc1a Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 10 Dec 2015 10:14:24 +0200 Subject: [PATCH 05/10] Update sysconf MAXPLAYERS docs a bit --- doc/Guidebook.tex | 2 +- doc/fixes36.1 | 1 + sys/unix/sysconf | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 7a0603431..1836afb68 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -3781,7 +3781,7 @@ A list of users who are allowed to use the explore mode. The syntax is the same as WIZARDS. %.lp \item[\ib{MAXPLAYERS}] -Limit the maximum number of games taht can be running at the same time. +Limit the maximum number of games that can be running at the same time. %.lp \item[\ib{SUPPORT}] A string explainign how to get local support (no default value). diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 54de20e75..118e5fb56 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -5,6 +5,7 @@ General Fixes and Modified Features doc/*.6 man pages and corresponding doc/*.txt text copies were out of date data.base entry for "lava" had wrong first name for Don Woods' attribution cursed genocide of "none" sent in monsters, but "that's enough tries" didn't +update MAXPLAYERS documentation in sysconf file and allow 0 for it Platform- and/or Interface-Specific Fixes diff --git a/sys/unix/sysconf b/sys/unix/sysconf index 1bed4487f..1347a7a9e 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -33,8 +33,8 @@ EXPLORERS=* # Limit the number of simultaneous games (see also nethack.sh). # Valid values are 0-25. # Commenting this out or setting the value to 0 constructs lock files -# with UID and username, so each user may have one game at a time, but -# number of different players is not limited. +# with UID and playername, so each user may have one game at a time, +# but number of different players is not limited. # Setting this to any other value constructs the lock files with # letter and "lock" (eg. alock, block, ...) MAXPLAYERS=10 From c14336fee204bc1577b8014eb8a74e6116baf774 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 10 Dec 2015 00:36:01 -0800 Subject: [PATCH 06/10] fruit enlightenment Move the 'if (wizard) { /* give feedback for named fruit */ }' code in ^X/enlightenment into an #if DEBUG block, and expand the if (wizard) predicate with '&& explicitdebug("fruit")' to require that 'fruit' be in DEBUGFILES. So, build with DEBUG enabled and run via |% DEBUGFILES='fruit' nethack to get it back.... This isn't actually a bug fix and it isn't necessary for 3.6.1, but I got tired of seeing ^X and end-of-game disclosure of attributes end with three lines about fruit when I'm not doing anything with named fruit. --- doc/fixes36.1 | 1 + src/cmd.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 118e5fb56..e84ba2817 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -6,6 +6,7 @@ doc/*.6 man pages and corresponding doc/*.txt text copies were out of date data.base entry for "lava" had wrong first name for Don Woods' attribution cursed genocide of "none" sent in monsters, but "that's enough tries" didn't update MAXPLAYERS documentation in sysconf file and allow 0 for it +wizard mode: don't include feedback about named fruit for ^X and enlightenment Platform- and/or Interface-Specific Fixes diff --git a/src/cmd.c b/src/cmd.c index 8fd20ef0c..24d68b1d9 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1446975462 2015/11/08 09:37:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.206 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1449736557 2015/12/10 08:35:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.208 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2245,8 +2245,10 @@ int final; } } - /* named fruit debugging (doesn't really belong here...) */ - if (wizard) { +#ifdef DEBUG + /* named fruit debugging (doesn't really belong here...); to enable, + include 'fruit' in DEBUGFILES list (even though it isn't a file...) */ + if (wizard && explicitdebug("fruit")) { int fcount = 0; struct fruit *f; char buf2[BUFSZ]; @@ -2260,6 +2262,7 @@ int final; Sprintf(buf, "%d", flags.made_fruit); enl_msg("The made fruit flag ", "is ", "was ", buf, ""); } +#endif { const char *p; From cee9426694f052822354e667daf98f6f9f8635c2 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 10 Dec 2015 01:34:09 -0800 Subject: [PATCH 07/10] fix #H4038 - distant name vs Eyes of the Overworld distant_name() temporarily blinded the hero before calling xname() or doname() in order to prevent the object being formatted from having its dknown flag set. The Eyes of the Overworld override blindness, so that bit got set for heros wearing them regardless of intention. This switches to a file-scope global instead of blindness as the way that distant_name() tells xname() not to set dknown. This bug has been present ever since the Eyes were added (3.3.0?). --- doc/fixes36.1 | 2 ++ src/objnam.c | 28 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index e84ba2817..aad10e4c3 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -7,6 +7,8 @@ data.base entry for "lava" had wrong first name for Don Woods' attribution cursed genocide of "none" sent in monsters, but "that's enough tries" didn't update MAXPLAYERS documentation in sysconf file and allow 0 for it wizard mode: don't include feedback about named fruit for ^X and enlightenment +looking at distant objects while wearing the Eyes of the Overworld made their + up-close descriptions known when not intended Platform- and/or Interface-Specific Fixes diff --git a/src/objnam.c b/src/objnam.c index 18d78fee1..bf68842e7 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1447490776 2015/11/14 08:46:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.154 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1449740045 2015/12/10 09:34:05 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.155 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -197,12 +197,13 @@ struct obj *obj; return TRUE; } +/* used by distant_name() to pass extra information to xname_flags(); + it would be much cleaner if this were a parameter, but that would + require all of the xname() and doname() calls to be modified */ +static int distantname = 0; + /* Give the name of an object seen at a distance. Unlike xname/doname, - * we don't want to set dknown if it's not set already. The kludge used is - * to temporarily set Blind so that xname() skips the dknown setting. This - * assumes that we don't want to do this too often; if this function becomes - * frequently used, it'd probably be better to pass a parameter to xname() - * or doname() instead. + * we don't want to set dknown if it's not set already. */ char * distant_name(obj, func) @@ -211,10 +212,17 @@ char *FDECL((*func), (OBJ_P)); { char *str; - long save_Blinded = Blinded; - Blinded = 1; + /* 3.6.1: this used to save Blind, set it, make the call, then restore + * the saved value; but the Eyes of the Overworld override blindness + * and let characters wearing them get dknown set for distant items. + * + * TODO? if the hero is wearing those Eyes, figure out whether the + * object is within X-ray radius and only treat it as distant when + * beyond that radius. Logic is iffy but result might be interesting. + */ + ++distantname; str = (*func)(obj); - Blinded = save_Blinded; + --distantname; return str; } @@ -271,7 +279,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ */ if (!nn && ocl->oc_uses_known && ocl->oc_unique) obj->known = 0; - if (!Blind) + if (!Blind && !distantname) obj->dknown = TRUE; if (Role_if(PM_PRIEST)) obj->bknown = TRUE; From 375a2c28f153976aff42e125e3fed35b7d9670f8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 10 Dec 2015 07:51:33 -0500 Subject: [PATCH 08/10] fixes updates for win32gui Changes to be committed: modified: doc/fixes36.0 modified: doc/fixes36.1 modified: win/win32/mhsplash.c modified: win/win32/mswproc.c --- doc/fixes36.0 | 1 + doc/fixes36.1 | 3 ++- win/win32/mhsplash.c | 21 +++++++++++++++++---- win/win32/mswproc.c | 5 ++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/doc/fixes36.0 b/doc/fixes36.0 index cc4947cbe..b285f4ab9 100644 --- a/doc/fixes36.0 +++ b/doc/fixes36.0 @@ -1185,6 +1185,7 @@ win32gui: added menu options "Copy ASCII Screenshot To Clipboard" and "Save win32gui, win32tty: add support for looking for sysconf in %COMMONPROGRAMFILES% first and for user config file in %USERPROFILE% (improves support for multi-login Windows environments) +win32gui: missing sys_early_init() call could result in "rnd(0) attempted" win32tty: support for 'selectsaved' option for menu of existing save files to choose from at game startup tty: add window port routines for saving/restoring message history diff --git a/doc/fixes36.1 b/doc/fixes36.1 index aad10e4c3..5dee5921f 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -15,7 +15,8 @@ Platform- and/or Interface-Specific Fixes ----------------------------------------- unix/X11: in top level Makefile, some commented out definitions of VARDATND misspelled pilemark.xbm (as pilemark.xpm) -win32gui: missing sys_early_init() call could result in "rnd(0) attempted" +win32gui: getversionstring() was overflowing the provided Help About buffer +win32gui: guard against buffer overflow in in mswin_getlin() MacOSX: initial binary release was built from out of date source code that had 'BETA' and 'DEBUG' inappropriately enabled X11: core bug for '`' (backtick) command was only noticed by X11 interface, diff --git a/win/win32/mhsplash.c b/win/win32/mhsplash.c index 4d2277249..680da598e 100644 --- a/win/win32/mhsplash.c +++ b/win/win32/mhsplash.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhsplash.c $NHDT-Date: 1432512813 2015/05/25 00:13:33 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.6 mhsplash.c $NHDT-Date: 1449751714 2015/12/10 12:48:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.27 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -94,11 +94,24 @@ mswin_display_splash_window(BOOL show_ver) if (show_ver) { /* Show complete version information */ dlb *f; + char verbuf[BUFSZ]; + int verstrsize = 0; + + getversionstring(verbuf); + verstrsize = strlen(verbuf); + if (verstrsize + strlen("\r\n\r\n") + 1 < BUFSZ - 1) + strcat(verbuf, "\r\n\r\n"); + verstrsize = strlen(verbuf); - getversionstring(buf + strsize); - strcat(buf, "\r\n\r\n"); + if (strsize + verstrsize + 1 > bufsize) { + bufsize += BUFSZ; + buf = realloc(buf, bufsize); + if (buf == NULL) + panic("out of memory"); + } + strcat(buf, verbuf); strsize = strlen(buf); - + /* Add compile options */ f = dlb_fopen(OPTIONS_USED, RDTMODE); if (f) { diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 593131ad5..e4f890260 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mswproc.c $NHDT-Date: 1449116670 2015/12/03 04:24:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.94 $ */ +/* NetHack 3.6 mswproc.c $NHDT-Date: 1449751720 2015/12/10 12:48:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.95 $ */ /* Copyright (C) 2001 by Alex Kompel */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,6 +12,7 @@ #include "func_tab.h" /* for extended commands */ #include "winMS.h" #include +#include #include "mhmap.h" #include "mhstatus.h" #include "mhtext.h" @@ -1640,6 +1641,8 @@ mswin_getlin(const char *question, char *input) if (len > 0) len--; input[len] = '\0'; + } else if (len>=(BUFSZ-1)) { + PlaySound((LPCSTR)SND_ALIAS_SYSTEMEXCLAMATION, NULL, SND_ALIAS_ID|SND_ASYNC); } else { input[len++] = c; input[len] = '\0'; From 367e92d642ed8c284fbc910e33e9f3380cc24a82 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 10 Dec 2015 10:54:00 -0500 Subject: [PATCH 09/10] reset fixes36.0 --- doc/fixes36.0 | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/fixes36.0 b/doc/fixes36.0 index b285f4ab9..cc4947cbe 100644 --- a/doc/fixes36.0 +++ b/doc/fixes36.0 @@ -1185,7 +1185,6 @@ win32gui: added menu options "Copy ASCII Screenshot To Clipboard" and "Save win32gui, win32tty: add support for looking for sysconf in %COMMONPROGRAMFILES% first and for user config file in %USERPROFILE% (improves support for multi-login Windows environments) -win32gui: missing sys_early_init() call could result in "rnd(0) attempted" win32tty: support for 'selectsaved' option for menu of existing save files to choose from at game startup tty: add window port routines for saving/restoring message history From ec94b94aff1c70e5a638e780b7ba5ee6a3748d3b Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 10 Dec 2015 10:55:06 -0500 Subject: [PATCH 10/10] roll back doc/fixes36.0 to released version --- doc/fixes36.0 | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/fixes36.0 b/doc/fixes36.0 index cc4947cbe..b285f4ab9 100644 --- a/doc/fixes36.0 +++ b/doc/fixes36.0 @@ -1185,6 +1185,7 @@ win32gui: added menu options "Copy ASCII Screenshot To Clipboard" and "Save win32gui, win32tty: add support for looking for sysconf in %COMMONPROGRAMFILES% first and for user config file in %USERPROFILE% (improves support for multi-login Windows environments) +win32gui: missing sys_early_init() call could result in "rnd(0) attempted" win32tty: support for 'selectsaved' option for menu of existing save files to choose from at game startup tty: add window port routines for saving/restoring message history