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.
This commit is contained in:
PatR
2022-08-22 14:03:28 -07:00
parent 4a84fb5b9d
commit 9541f17126
3 changed files with 13 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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*/