another getobj/force_invmenu fix

For !force_invmenu when attempting a command that needs an object,
if inventory is completely empty
 What do you want to <foo>? [*]
will report "Never mind" and stop asking if player presses return
or report "Not carrying anything" and reprompt if player types '*'.
But for force_invmenu, it would report
 Not carrying anything.  Never mind.
without any reprompting in between the two messages.  Just skip
the second message in that situation.

Perhaps the first case should avoid reprompting too but I haven't
gone that far.
This commit is contained in:
PatR
2021-03-20 10:52:46 -07:00
parent 81a1b9b3ca
commit fb7b7d5721
2 changed files with 7 additions and 1 deletions

View File

@@ -553,6 +553,9 @@ engraving with non-blade dulled the weapon anyway (pr #464)
loss of saddle by opening magic left hero mounted on unsaddled steed
avoid segfault during error reporting for bad 'O' value(s) after theme rooms
have been initialized, leaving iflags.in_lua set
avoid complaints of "nothing to foo" for 'force_invmenu' if there are no
likely candidates to foo with but there are hidden acceptable choices
avoid "Not carrying anything. Never mind." for 'force_invmenu'
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -1632,8 +1632,11 @@ getobj(const char *word,
ilet = display_pickinv(allowed_choices, *qbuf ? qbuf : (char *) 0,
menuquery,
TRUE, allowcnt ? &ctmp : (long *) 0);
if (!ilet)
if (!ilet) {
if (oneloop)
return (struct obj *) 0;
continue;
}
if (ilet == HANDS_SYM)
return (struct obj *) &cg.zeroobj; /* cast away 'const' */
if (ilet == '\033') {