From fb7b7d5721f870bc1004bbe7fd2f1e775c61f9eb Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 20 Mar 2021 10:52:46 -0700 Subject: [PATCH] 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 ? [*] 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. --- doc/fixes37.0 | 3 +++ src/invent.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 126fba511..7583d74ae 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/invent.c b/src/invent.c index 9f8999609..5710fadc9 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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') {