invent fixes

Fix the reported problem of a crash when using the curses interface
when examining inventory while carrying only gold, and a blank menu
for tty in the same circumstance.  Triggered by changes made for
TTY_PERM_INVENT but doesn't require that to be enabled.

Not fixed: with curses, starting with perm_invent Off and toggling it
On (with sufficient screen real estate to show it) doesn't display it.
Doing something to update it like pickup or drop causes it to appear.
(^R isn't enough.)
This commit is contained in:
PatR
2022-08-15 11:41:28 -07:00
parent be0def37c1
commit e9f59090c2
2 changed files with 14 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.975 $ $NHDT-Date: 1657868310 2022/07/15 06:58:30 $
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1011 $ $NHDT-Date: 1660588881 2022/08/15 18:41:21 $
General Fixes and Modified Features
-----------------------------------
@@ -1372,6 +1372,9 @@ curses: when entering a count while in a menu, cursor would jump to the spot
on screen where the hero was, even if menu covered that part of map;
post-3.6--started when curses was changed to use core's get_count()
curses: clipped map crashed due to uninitialized memory
curses: changes for tty's TTY_PERM_INVENT resulted in viewing inventory under
curses while carrying only gold to crash; didn't matter if perm_invent
was On or if TTY_PERM_INVENT was enabled
Qt: at Xp levels above 20 with 'showexp' On, the combined status field
"Level:NN/nnnnnnnn" was too big and truncated by a char at each end
Qt: searching a text window for something that wasn't found and then searching
@@ -1389,6 +1392,9 @@ tty: for #wizidentify, using ^I as an unseen group accelerator to pick the
failing, so the 'all' choice wasn't being toggled on if user typed ^I
tty: changes to support utf8 resulted in lines of text windows being shown
starting at their second character
tty: changes to support TTY_PERM_INVENT resulted in blank inventory menu when
using the 'i' command while carrying only gold; didn't matter whether
or not TTY_PERM_INVENT was enabled during build
Unix: after lua changes to Makefiles, 'make spotless' for dat subdirectory
left some generated data files which should have been deleted
Windows: new tile additions in win/share did not trigger the creation of a new

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 invent.c $NHDT-Date: 1654205933 2022/06/02 21:38:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.391 $ */
/* NetHack 3.7 invent.c $NHDT-Date: 1660588881 2022/08/15 18:41:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.418 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2464,9 +2464,8 @@ update_inventory(void)
if (WINDOWPORT(tty))
sync_perminvent();
else
#else
(*windowprocs.win_update_inventory)(0);
#endif
(*windowprocs.win_update_inventory)(0);
iflags.suppress_price = save_suppress_price;
}
@@ -3227,6 +3226,7 @@ display_pickinv(
if (g.cached_pickinv_win == WIN_ERR)
g.cached_pickinv_win = create_nhwindow(NHW_MENU);
win = g.cached_pickinv_win;
show_gold = TRUE;
} else {
win = WIN_INVEN;
menu_behavior = MENU_BEHAVE_PERMINV;
@@ -5474,7 +5474,8 @@ sync_perminvent(void)
/* Send windowport a request to return the related settings to us */
if ((iflags.perm_invent && !g.core_invent_state)
|| in_perm_invent_toggled) {
if ((wri = ctrl_nhwindow(WIN_INVEN, request_settings, &wri_info))) {
if ((wri = ctrl_nhwindow(WIN_INVEN, request_settings, &wri_info))
!= 0) {
if ((wri->tocore.tocore_flags & prohibited) != 0) {
/* sizes aren't good enough */
set_option_mod_status("perm_invent", set_gameview);
@@ -5502,7 +5503,8 @@ sync_perminvent(void)
if (!wri || wri->tocore.maxslot == 0)
return;
if (in_perm_invent_toggled && g.perm_invent_toggling_direction == toggling_on) {
if (in_perm_invent_toggled
&& g.perm_invent_toggling_direction == toggling_on) {
WIN_INVEN = create_nhwindow(NHW_MENU);
}