diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 1291c29d7..287b74044 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.177 $ $NHDT-Date: 1573778559 2019/11/15 00:42:39 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.178 $ $NHDT-Date: 1573848574 2019/11/15 20:09:34 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -225,6 +225,13 @@ putting on gloves while having slippery fingers transfered slipperiness to when a monster reads a scroll of fire to cure sliming, don't access that scroll's memory after it has been used up (bcsign) monster vs monster attacks didn't handle shades or silver weapon feedback +successful alchemy would show new potion's description (color) even when blind +dipping some types of objects into oil would yield " gleams with an + oily sheen" even when blind +dipping into an undiscovered potion would offer chance to give a name to the + potion even when its description wasn't known (picked up while blind) +dipping lichen corpse into acid when not blind and acid was undicovered would + not offer a chance to give a name to the potion after lichen feedback Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/include/decl.h b/include/decl.h index 66033f783..a3abede0f 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 decl.h $NHDT-Date: 1559601011 2019/06/03 22:30:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.150 $ */ +/* NetHack 3.6 decl.h $NHDT-Date: 1573869061 2019/11/16 01:51:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.165 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2007. */ /* NetHack may be freely redistributed. See license for details. */ diff --git a/include/extern.h b/include/extern.h index 9a8febdbd..e8860445b 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1573688684 2019/11/13 23:44:44 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.739 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1573869062 2019/11/16 01:51:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.740 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2931,10 +2931,13 @@ E void NDECL(nhwindows_hangup); #endif E void NDECL(genl_status_init); E void NDECL(genl_status_finish); -E void FDECL(genl_status_enablefield, - (int, const char *, const char *, BOOLEAN_P)); -E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, unsigned long *)); - +E void FDECL(genl_status_enablefield, (int, const char *, const char *, + BOOLEAN_P)); +E void FDECL(genl_status_update, (int, genericptr_t, int, int, int, + unsigned long *)); +#ifdef DUMPLOG +E char *FDECL(dump_fmtstr, (const char *, char *, BOOLEAN_P)); +#endif E void FDECL(dump_open_log, (time_t)); E void NDECL(dump_close_log); E void FDECL(dump_redirect, (BOOLEAN_P)); diff --git a/src/decl.c b/src/decl.c index 42c8b62b5..6a22e8820 100644 --- a/src/decl.c +++ b/src/decl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 decl.c $NHDT-Date: 1571352532 2019/10/17 22:48:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.146 $ */ +/* NetHack 3.6 decl.c $NHDT-Date: 1573869062 2019/11/16 01:51:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2009. */ /* NetHack may be freely redistributed. See license for details. */ diff --git a/src/end.c b/src/end.c index fa758fe43..f37caf8ad 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1562532734 2019/07/07 20:52:14 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.179 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1573869062 2019/11/16 01:51:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.180 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -238,8 +238,8 @@ NH_panictrace_gdb() #ifdef PANICTRACE_GDB /* A (more) generic method to get a stack trace - invoke * gdb on ourself. */ - char *gdbpath = GDBVAR; - char *greppath = GREPVAR; + const char *gdbpath = GDBVAR; + const char *greppath = GREPVAR; char buf[BUFSZ]; FILE *gdb; @@ -248,8 +248,8 @@ NH_panictrace_gdb() if (greppath == NULL || greppath[0] == 0) return FALSE; - sprintf(buf, "%s -n -q %s %d 2>&1 | %s '^#'", gdbpath, ARGV0, getpid(), - greppath); + sprintf(buf, "%s -n -q %s %d 2>&1 | %s '^#'", + gdbpath, ARGV0, getpid(), greppath); gdb = popen(buf, "w"); if (gdb) { raw_print("Generating more information you may report:\n"); diff --git a/src/files.c b/src/files.c index 2de453dca..e1bcf88aa 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 files.c $NHDT-Date: 1573358489 2019/11/10 04:01:29 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.263 $ */ +/* NetHack 3.6 files.c $NHDT-Date: 1573869063 2019/11/16 01:51:03 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.269 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2533,13 +2533,12 @@ char *origbuf; static boolean ramdisk_specified = FALSE; #endif #ifdef SYSCF - int n; + int n, src = iflags.parse_config_file_src; #endif char *bufp, buf[4 * BUFSZ]; uchar translate[MAXPCHARS]; int len; boolean retval = TRUE; - int src = iflags.parse_config_file_src; /* convert any tab to space, condense consecutive spaces into one, remove leading and trailing spaces (exception: if there is nothing @@ -4265,16 +4264,16 @@ boolean wildcards; void reveal_paths(VOID_ARGS) { - const char *fqn, *filep; + const char *fqn, *gamename = (g.hname && *g.hname) ? g.hname : "NetHack"; char buf[BUFSZ]; -#if defined(UNIX) - char *strp; +#if defined(SYSCF) || !defined(UNIX) + const char *filep; #endif #if defined(PREFIXES_IN_USE) const char *cstrp; #endif #ifdef UNIX - char *envp, cwdbuf[PATH_MAX]; + char *endp, *envp, cwdbuf[PATH_MAX]; #endif #ifdef PREFIXES_IN_USE int i, maxlen = 0; @@ -4291,12 +4290,12 @@ reveal_paths(VOID_ARGS) #ifdef PREFIXES_IN_USE cstrp = fqn_prefix_names[SYSCONFPREFIX]; maxlen = BUFSZ - sizeof " (in )"; - if (cstrp && strlen(cstrp) < (size_t) maxlen) + if (cstrp && (int) strlen(cstrp) < maxlen) Sprintf(buf, " (in %s)", cstrp); #else buf[0] = '\0'; #endif - raw_printf("Your system configuration file%s:", buf); + raw_printf("%s system configuration file%s:", s_suffix(gamename), buf); #ifdef SYSCF_FILE filep = SYSCF_FILE; #else @@ -4323,16 +4322,16 @@ reveal_paths(VOID_ARGS) cstrp = fqn_prefix_names[HACKPREFIX]; #endif /* WIN32 */ maxlen = BUFSZ - sizeof " (in )"; - if (cstrp && strlen(cstrp) < (size_t) maxlen) + if (cstrp && (int) strlen(cstrp) < maxlen) Sprintf(buf, " (in %s)", cstrp); #endif /* PREFIXES_IN_USE */ - raw_printf("Your game's loadable symbols file%s:", buf); + raw_printf("%s loadable symbols file%s:", s_suffix(gamename), buf); #endif /* UNIX */ #ifdef UNIX envp = getcwd(cwdbuf, PATH_MAX); if (envp) { - raw_print("Your game's loadable symbols file:"); + raw_printf("%s loadable symbols file:", s_suffix(gamename)); raw_printf(" \"%s/%s\"", envp, SYMBOLS); } #else /* UNIX */ @@ -4355,7 +4354,7 @@ reveal_paths(VOID_ARGS) #ifdef PREFIXES_IN_USE cstrp = fqn_prefix_names[CONFIGPREFIX]; maxlen = BUFSZ - sizeof " (in )"; - if (cstrp && strlen(cstrp) < (size_t) maxlen) + if (cstrp && (int) strlen(cstrp) < maxlen) Sprintf(buf, " (in %s)", cstrp); #endif /* PREFIXES_IN_USE */ raw_printf("Your personal configuration file%s:", buf); @@ -4366,26 +4365,26 @@ reveal_paths(VOID_ARGS) copynchars(buf, envp, (int) sizeof buf - 1 - 1); Strcat(buf, "/"); } - strp = eos(buf); - copynchars(strp, default_configfile, + endp = eos(buf); + copynchars(endp, default_configfile, (int) (sizeof buf - 1 - strlen(buf))); #if defined(__APPLE__) /* UNIX+__APPLE__ => MacOSX aka OSX aka macOS */ if (envp) { if (access(buf, 4) == -1) { /* 4: R_OK, -1: failure */ /* read access to default failed; might be protected excessively but more likely it doesn't exist; try first alternate: - "$HOME/Library/Pref..."; 'strp' points past '/' */ - copynchars(strp, "Library/Preferences/NetHack Defaults", + "$HOME/Library/Pref..."; 'endp' points past '/' */ + copynchars(endp, "Library/Preferences/NetHack Defaults", (int) (sizeof buf - 1 - strlen(buf))); if (access(buf, 4) == -1) { /* first alternate failed, try second: - ".../NetHack Defaults.txt"; no 'strp', just append */ + ".../NetHack Defaults.txt"; no 'endp', just append */ copynchars(eos(buf), ".txt", (int) (sizeof buf - 1 - strlen(buf))); if (access(buf, 4) == -1) { /* second alternate failed too, so revert to the original default ("$HOME/.nethackrc") for message */ - copynchars(strp, default_configfile, + copynchars(endp, default_configfile, (int) (sizeof buf - 1 - strlen(buf))); } } @@ -4400,6 +4399,26 @@ reveal_paths(VOID_ARGS) #endif raw_printf(" \"%s\"", fqn ? fqn : default_configfile); #endif /* ?UNIX */ + +#ifdef DUMPLOG +#ifdef SYSCF + fqn = sysopt.dumplogfile; +#else /* !SYSCF */ +#ifdef DUMPLOG_FILE + fqn = DUMPLOG_FILE; +#else + fqn = (char *) 0; +#endif +#endif /* ?SYSCF */ + if (fqn) { + raw_print("Your end-of-game dump file:"); + (void) dump_fmtstr(fqn, buf, FALSE); + buf[sizeof buf - sizeof " \"\""] = '\0'; + raw_printf(" \"%s\"", buf); + } else +#endif /* DUMPLOG */ + raw_print("No end-of-game dump file."); + raw_print(""); } diff --git a/src/potion.c b/src/potion.c index cfb4d78ff..3d3c639b0 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1573346191 2019/11/10 00:36:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.166 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1573848199 2019/11/15 20:03:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.167 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2027,7 +2027,7 @@ dodip() around for potionbreathe() [and we can't set obj->in_use to 'amt' because that's not implemented] */ obj->in_use = 1; - pline("BOOM! They explode!"); + pline("%sThey explode!", !Deaf ? "BOOM! " : ""); wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1)); exercise(A_STR, FALSE); if (!breathless(g.youmonst.data) || haseyes(g.youmonst.data)) @@ -2045,6 +2045,8 @@ dodip() if (mixture != STRANGE_OBJECT) { obj->otyp = mixture; } else { + struct obj *otmp; + switch (obj->odiluted ? 1 : rnd(8)) { case 1: obj->otyp = POT_WATER; @@ -2053,17 +2055,15 @@ dodip() case 3: obj->otyp = POT_SICKNESS; break; - case 4: { - struct obj *otmp = mkobj(POTION_CLASS, FALSE); - + case 4: + otmp = mkobj(POTION_CLASS, FALSE); obj->otyp = otmp->otyp; obfree(otmp, (struct obj *) 0); break; - } default: useupall(obj); - if (!Blind) - pline_The("mixture glows brightly and evaporates."); + pline_The("mixture %sevaporates.", + !Blind ? "glows brightly and " : ""); return 1; } } @@ -2089,11 +2089,16 @@ dodip() } if (potion->otyp == POT_ACID && obj->otyp == CORPSE - && obj->corpsenm == PM_LICHEN && !Blind) { + && obj->corpsenm == PM_LICHEN) { pline("%s %s %s around the edges.", The(cxname(obj)), - otense(obj, "turn"), - potion->odiluted ? hcolor(NH_ORANGE) : hcolor(NH_RED)); + otense(obj, "turn"), Blind ? "wrinkled" + : potion->odiluted ? hcolor(NH_ORANGE) + : hcolor(NH_RED)); potion->in_use = FALSE; /* didn't go poof */ + if (potion->dknown + && !objects[potion->otyp].oc_name_known + && !objects[potion->otyp].oc_uname) + docall(potion); return 1; } @@ -2147,10 +2152,14 @@ dodip() } else if ((!is_rustprone(obj) && !is_corrodeable(obj)) || is_ammo(obj) || (!obj->oeroded && !obj->oeroded2)) { /* uses up potion, doesn't set obj->greased */ - pline("%s %s with an oily sheen.", Yname2(obj), - otense(obj, "gleam")); + if (!Blind) + pline("%s %s with an oily sheen.", Yname2(obj), + otense(obj, "gleam")); + else /*if (!uarmg)*/ + pline("%s %s oily.", Yname2(obj), otense(obj, "feel")); } else { - pline("%s %s less %s.", Yname2(obj), otense(obj, "are"), + pline("%s %s less %s.", Yname2(obj), + otense(obj, !Blind ? "are" : "feel"), (obj->oeroded && obj->oeroded2) ? "corroded and rusty" : obj->oeroded ? "rusty" : "corroded"); @@ -2161,7 +2170,8 @@ dodip() wisx = TRUE; } exercise(A_WIS, wisx); - makeknown(potion->otyp); + if (potion->dknown) + makeknown(potion->otyp); useup(potion); return 1; } @@ -2197,7 +2207,8 @@ dodip() useup(potion); exercise(A_WIS, TRUE); } - makeknown(POT_OIL); + if (potion->dknown) + makeknown(POT_OIL); obj->spe = 1; update_inventory(); return 1; @@ -2235,16 +2246,24 @@ dodip() singlepotion->dknown = FALSE; } else { singlepotion->dknown = !Hallucination; + *newbuf = '\0'; if (mixture == POT_WATER && singlepotion->dknown) Sprintf(newbuf, "clears"); - else + else if (!Blind) Sprintf(newbuf, "turns %s", hcolor(OBJ_DESCR(objects[mixture]))); - pline_The("%spotion%s %s.", oldbuf, - more_than_one ? " that you dipped into" : "", newbuf); - if (!objects[old_otyp].oc_uname - && !objects[old_otyp].oc_name_known && old_dknown) { + if (*newbuf) + pline_The("%spotion%s %s.", oldbuf, + more_than_one ? " that you dipped into" : "", + newbuf); + else + pline("Somehing happens."); + + if (old_dknown + && !objects[old_otyp].oc_name_known + && !objects[old_otyp].oc_uname) { struct obj fakeobj; + fakeobj = cg.zeroobj; fakeobj.dknown = 1; fakeobj.otyp = old_otyp; @@ -2266,7 +2285,8 @@ dodip() return 1; poof: - if (!objects[potion->otyp].oc_name_known + if (potion->dknown + && !objects[potion->otyp].oc_name_known && !objects[potion->otyp].oc_uname) docall(potion); useup(potion); diff --git a/src/windows.c b/src/windows.c index dfb3f3629..475d2d895 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 windows.c $NHDT-Date: 1526933747 2018/05/21 20:15:47 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.48 $ */ +/* NetHack 3.6 windows.c $NHDT-Date: 1573869064 2019/11/16 01:51:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.58 $ */ /* Copyright (c) D. Cohrs, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1089,12 +1089,13 @@ static FILE *dumplog_file; #ifdef DUMPLOG static time_t dumplog_now; -static char *FDECL(dump_fmtstr, (const char *, char *)); - -static char * -dump_fmtstr(fmt, buf) +char * +dump_fmtstr(fmt, buf, fullsubs) const char *fmt; char *buf; +boolean fullsubs; /* True -> full substitution for file name, False -> + * partial substitution for '--showpaths' feedback + * where there's no game in progress when executed */ { const char *fp = fmt; char *bp = buf; @@ -1117,7 +1118,7 @@ char *buf; * may or may not interfere with that usage.] */ - while (fp && *fp && len < BUFSZ-1) { + while (fp && *fp && len < BUFSZ - 1) { if (*fp == '%') { fp++; switch (*fp) { @@ -1128,17 +1129,29 @@ char *buf; Sprintf(tmpbuf, "%%"); break; case 't': /* game start, timestamp */ - Sprintf(tmpbuf, "%lu", (unsigned long) ubirthday); + if (fullsubs) + Sprintf(tmpbuf, "%lu", (unsigned long) ubirthday); + else + Strcpy(tmpbuf, "{game start cookie}"); break; case 'T': /* current time, timestamp */ - Sprintf(tmpbuf, "%lu", (unsigned long) now); + if (fullsubs) + Sprintf(tmpbuf, "%lu", (unsigned long) now); + else + Strcpy(tmpbuf, "{current time cookie}"); break; case 'd': /* game start, YYYYMMDDhhmmss */ - Sprintf(tmpbuf, "%08ld%06ld", - yyyymmdd(ubirthday), hhmmss(ubirthday)); + if (fullsubs) + Sprintf(tmpbuf, "%08ld%06ld", + yyyymmdd(ubirthday), hhmmss(ubirthday)); + else + Strcpy(tmpbuf, "{game start date+time}"); break; case 'D': /* current time, YYYYMMDDhhmmss */ - Sprintf(tmpbuf, "%08ld%06ld", yyyymmdd(now), hhmmss(now)); + if (fullsubs) + Sprintf(tmpbuf, "%08ld%06ld", yyyymmdd(now), hhmmss(now)); + else + Strcpy(tmpbuf, "{current date+time}"); break; case 'v': /* version, eg. "3.6.2-0" */ Sprintf(tmpbuf, "%s", version_string(verbuf)); @@ -1147,19 +1160,37 @@ char *buf; Sprintf(tmpbuf, "%ld", uid); break; case 'n': /* player name */ - Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown"); + if (fullsubs) + Sprintf(tmpbuf, "%s", *g.plname ? g.plname : "unknown"); + else + Strcpy(tmpbuf, "{hero name}"); break; case 'N': /* first character of player name */ - Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u'); + if (fullsubs) + Sprintf(tmpbuf, "%c", *g.plname ? *g.plname : 'u'); + else + Strcpy(tmpbuf, "{hero initial}"); break; } + if (fullsubs) { + /* replace potentially troublesome characters (including + even though it might be an acceptable file name + character); user shouldn't be able to get ' ' or '/' + or '\\' into plname[] but play things safe */ + (void) strNsubst(tmpbuf, " ", "_", 0); + (void) strNsubst(tmpbuf, "/", "_", 0); + (void) strNsubst(tmpbuf, "\\", "_", 0); + /* note: replacements are only done on field substitutions, + not on the template (from sysconf or DUMPLOG_FILE) */ + } - slen = strlen(tmpbuf); - if (len + slen < BUFSZ-1) { + slen = (int) strlen(tmpbuf); + if (len + slen < BUFSZ - 1) { len += slen; Sprintf(bp, "%s", tmpbuf); bp += slen; - if (*fp) fp++; + if (*fp) + fp++; } else break; } else { @@ -1187,9 +1218,9 @@ time_t now; #ifdef SYSCF if (!sysopt.dumplogfile) return; - fname = dump_fmtstr(sysopt.dumplogfile, buf); + fname = dump_fmtstr(sysopt.dumplogfile, buf, TRUE); #else - fname = dump_fmtstr(DUMPLOG_FILE, buf); + fname = dump_fmtstr(DUMPLOG_FILE, buf, TRUE); #endif dumplog_file = fopen(fname, "w"); dumplog_windowprocs_backup = windowprocs;