From 9541f1712674fa73781c4cc15898ef7f5a66844e Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 22 Aug 2022 14:03:28 -0700 Subject: [PATCH] fix end-of-game DUMPLOG panic dump_create_nhwindow() has been returning a bogus value. In the past that didn't make any difference but after some recent perm_invent changes, it started triggering a panic when writing the inventory portion of DUMPLOG. The changes to invent.c just avoid attempting to create a window that won't be used. --- doc/fixes3-7-0.txt | 4 +++- src/invent.c | 10 +++++++--- src/windows.c | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index da9481db8..5683261ad 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1011 $ $NHDT-Date: 1660588881 2022/08/15 18:41:21 $ +HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1021 $ $NHDT-Date: 1661202204 2022/08/22 21:03:24 $ General Fixes and Modified Features ----------------------------------- @@ -1363,6 +1363,8 @@ when using --nethackrc=file on the command line (currently only implemented using 'o'pen as a synonym for #loot of a container at the hero's location did not work if the hero was in a pit update '?' menu to reflect change to 'O' command +end of game with DUMPLOG could panic due to perm_invent handling, even when + the persistent inventory window wasn't in use curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/invent.c b/src/invent.c index a5f95b28f..df76ffdba 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 invent.c $NHDT-Date: 1660588881 2022/08/15 18:41:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.418 $ */ +/* NetHack 3.7 invent.c $NHDT-Date: 1661202200 2022/08/22 21:03:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.423 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3219,11 +3219,15 @@ display_pickinv( if (lets && !*lets) lets = 0; /* simplify tests: (lets) instead of (lets && *lets) */ - if (!iflags.perm_invent +#ifdef DUMPLOG + if (iflags.in_dumplog) { + win = 0; /* passed to dump_putstr() which ignores it... */ + } else +#endif + if (lets || xtra_choice || wizid || want_reply #ifdef TTY_PERM_INVENT || !g.in_sync_perminvent #endif - || (lets || xtra_choice || wizid || want_reply) || WIN_INVEN == WIN_ERR) { /* partial inventory in perm_invent setting; don't operate on full inventory window, use an alternate one instead; create diff --git a/src/windows.c b/src/windows.c index 6a1d52547..c1c983e21 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 windows.c $NHDT-Date: 1647472699 2022/03/16 23:18:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.86 $ */ +/* NetHack 3.7 windows.c $NHDT-Date: 1661202202 2022/08/22 21:03:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */ /* Copyright (c) D. Cohrs, 1993. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1256,9 +1256,9 @@ dump_putstr(winid win UNUSED, int attr UNUSED, const char *str) } static winid -dump_create_nhwindow(int dummy) +dump_create_nhwindow(int type UNUSED) { - return dummy; + return WIN_ERR; } /*ARGUSED*/