^I vs perm_invent again

A recent fix for #wizidentify showing "Not carrying anything" after
listing inventory items still showed "Not carrying anything" after
"(all items are already identified)".  Fix is easy.

Trickier bug was that ^I performs object ID on selected items while
the inventory routine is still in progress (but after it has processed
every item) and the ID routine will call update_inventory() which
will call the inventory routine to reformat invent.  So the inventory
display routine was called recursively without having returned to
wizidentify where iflags.override_ID gets cleared to revert to normal
inventory.  The nested call was unintentionally narrowing the contents
of persistent inventory window to whatever items were still unIDed.
(Any inventory update, including ^R, restored it to full inventory.)
This commit is contained in:
PatR
2019-06-28 12:50:08 -07:00
parent bed5570e3b
commit 7013563415
2 changed files with 15 additions and 5 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.76 $ $NHDT-Date: 1561750114 2019/06/28 19:28:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.77 $ $NHDT-Date: 1561751390 2019/06/28 19:49:50 $
This fixes36.3 file is here to capture information about updates in the 3.6.x 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, lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -86,6 +86,9 @@ partly eaten food with one bite left had message anomalies when eaten; the
resulted in no messages at all when restarting and finishing last bite resulted in no messages at all when restarting and finishing last bite
wizard mode ^I menu could list "Not carrying anything" after inventory items wizard mode ^I menu could list "Not carrying anything" after inventory items
if perm_invent option was On (even on tty where that's not supported) if perm_invent option was On (even on tty where that's not supported)
wizard mode ^I with 'perm_invent' On would unintentionally filter the content
of the persistent inventory window to unIDed items if any item got
chosen to be identified (^R would fix it, as would any invent change)
change #adjust to treat carrying only gold as not having anything to adjust change #adjust to treat carrying only gold as not having anything to adjust
saving bones with 'perm_invent' On could result in "Bad fruit #N" warnings saving bones with 'perm_invent' On could result in "Bad fruit #N" warnings
update persistent inventory window immediately if 'sortpack' option is toggled update persistent inventory window immediately if 'sortpack' option is toggled
@@ -103,6 +106,8 @@ for wizard mode 'wizweight' option, glob weight wasn't shown unless glob had
shop price information attached shop price information attached
fix for feedback when a monster plays a fire horn at self to cure green slime fix for feedback when a monster plays a fire horn at self to cure green slime
ended up being used for zapping a wand of fire at self too ended up being used for zapping a wand of fire at self too
wizard mode ^I "not carrying anything" still claimed "not carrying anything"
if "(all items are already identified)" was given
curses: sometimes the message window would show a blank line after a prompt curses: sometimes the message window would show a blank line after a prompt
curses: the change to show map in columns 1..79 instead of 2..80 made the curses: the change to show map in columns 1..79 instead of 2..80 made the
highlight for '@' show up in the wrong place if clipped map had been highlight for '@' show up in the wrong place if clipped map had been
+9 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1561314651 2019/06/23 18:30:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.259 $ */ /* NetHack 3.6 invent.c $NHDT-Date: 1561751391 2019/06/28 19:49:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.260 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2550,12 +2550,12 @@ long *out_cnt;
menu_item *selected; menu_item *selected;
unsigned sortflags; unsigned sortflags;
Loot *sortedinvent, *srtinv; Loot *sortedinvent, *srtinv;
boolean wizid = FALSE, gotsomething = FALSE; boolean wizid = (wizard && iflags.override_ID), gotsomething = FALSE;
if (lets && !*lets) if (lets && !*lets)
lets = 0; /* simplify tests: (lets) instead of (lets && *lets) */ lets = 0; /* simplify tests: (lets) instead of (lets && *lets) */
if (iflags.perm_invent && (lets || xtra_choice)) { if (iflags.perm_invent && (lets || xtra_choice || wizid)) {
/* partial inventory in perm_invent setting; don't operate on /* partial inventory in perm_invent setting; don't operate on
full inventory window, use an alternate one instead; create full inventory window, use an alternate one instead; create
the first time needed and keep it for re-use as needed later */ the first time needed and keep it for re-use as needed later */
@@ -2647,6 +2647,7 @@ long *out_cnt;
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"(all items are permanently identified already)", "(all items are permanently identified already)",
MENU_UNSELECTED); MENU_UNSELECTED);
gotsomething = TRUE;
} else { } else {
any.a_obj = &wizid_fakeobj; any.a_obj = &wizid_fakeobj;
Sprintf(prompt, "select %s to permanently identify", Sprintf(prompt, "select %s to permanently identify",
@@ -2661,7 +2662,7 @@ long *out_cnt;
visctrl(iflags.override_ID)); visctrl(iflags.override_ID));
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE, add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
prompt, MENU_UNSELECTED); prompt, MENU_UNSELECTED);
wizid = gotsomething = TRUE; gotsomething = TRUE;
} }
} else if (xtra_choice) { } else if (xtra_choice) {
/* wizard override ID and xtra_choice are mutually exclusive */ /* wizard override ID and xtra_choice are mutually exclusive */
@@ -2737,6 +2738,10 @@ long *out_cnt;
if (wizid) { if (wizid) {
int i; int i;
/* identifying items will update perm_invent, calling this
routine recursively, and we don't want the nested call
to filter on unID'd items */
iflags.override_ID = 0;
ret = '\0'; ret = '\0';
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
otmp = selected[i].item.a_obj; otmp = selected[i].item.a_obj;