fix #6284 - empty perm_invent

Report was for tty, but X11 exhibited the same behavior.  With the
perm_invent option enabled, when the permanent inventory window is
displayed, it would be empty if not carrying anything.  For tty, that
meant a naked "(end) " selection prompt.  Put a separator line of "Not
carrying anything" into the menu so that it won't be completely empty.
The selection prompt is still present but it is attached to something.
(The behavior is different from !perm_invent, where you get that same
text via pline without any menu at all.)
This commit is contained in:
PatR
2017-10-28 14:12:50 -07:00
parent bba7a6b44c
commit 72978d69fa
3 changed files with 23 additions and 7 deletions

View File

@@ -466,6 +466,7 @@ sometimes rings dropped into sinks can be found in the pipes
doors in special levels were always generated in vertical orientation
assigning a type name to a potion on the floor which is actually a mimic could
prompt "Call a stream of <potion-type> fluid:" (bogus 'fromsink')
with perm_invent option enabled and no inventory, 'i' put up an empty menu
Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository

View File

@@ -1274,8 +1274,11 @@ int how;
if (have_windows) {
wait_synch();
free_pickinv_cache(); /* extra persistent window if perm_invent */
if (WIN_INVEN != WIN_ERR)
if (WIN_INVEN != WIN_ERR) {
destroy_nhwindow(WIN_INVEN), WIN_INVEN = WIN_ERR;
/* precaution in case any late update_inventory() calls occur */
flags.perm_invent = 0;
}
display_nhwindow(WIN_MESSAGE, TRUE);
destroy_nhwindow(WIN_MAP), WIN_MAP = WIN_ERR;
#ifndef STATUS_HILITES
@@ -1315,7 +1318,7 @@ int how;
? (const char *) ((flags.female && urole.name.f)
? urole.name.f
: urole.name.m)
: (const char *) (flags.female ? "Demigoddess" : "Demigod"));
: (const char *) (flags.female ? "Demigoddess" : "Demigod"));
dump_forward_putstr(endwin, 0, pbuf, done_stopprint);
dump_forward_putstr(endwin, 0, "", done_stopprint);
@@ -1350,6 +1353,7 @@ int how;
Schroedingers_cat = odds_and_ends(invent, CAT_CHECK);
if (Schroedingers_cat) {
int mhp, m_lev = adj_lev(&mons[PM_HOUSECAT]);
mhp = d(m_lev, 8);
nowrap_add(u.urexp, mhp);
Strcat(eos(pbuf), " and Schroedinger's cat");

View File

@@ -2180,6 +2180,7 @@ const char *query;
boolean want_reply;
long *out_cnt;
{
static const char not_carrying_anything[] = "Not carrying anything";
struct obj *otmp;
char ilet, ret;
char *invlet = flags.inv_order;
@@ -2226,7 +2227,7 @@ long *out_cnt;
++n;
if (n == 0) {
pline("Not carrying anything.");
pline("%s.", not_carrying_anything);
return 0;
}
@@ -2314,14 +2315,24 @@ nextclass:
goto nextclass;
}
}
if (iflags.force_invmenu && lets && want_reply) {
any = zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Special", MENU_UNSELECTED);
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Special", MENU_UNSELECTED);
any.a_char = '*';
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE, "(list everything)", MENU_UNSELECTED);
add_menu(win, NO_GLYPH, &any, '*', 0, ATR_NONE,
"(list everything)", MENU_UNSELECTED);
}
/* for permanent inventory where we intend to show everything but
nothing has been listed (because there isn't anyhing to list;
recognized via any.a_char still being zero; the n==0 case above
gets skipped for perm_invent), put something into the menu */
if (flags.perm_invent && !lets && !any.a_char) {
any = zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, 0,
not_carrying_anything, MENU_UNSELECTED);
want_reply = FALSE;
}
end_menu(win, query && *query ? query : (char *) 0);
n = select_menu(win, want_reply ? PICK_ONE : PICK_NONE, &selected);