refine #1106 - invent action: item lookup

Only show the '/' menu choice for context-sensitive inventory item
action if data.base look up for the item will find something.  Lack
of '/' is as informative as "you don't know anything about that".

Harder to implement than expected but seems to be working ok.

This also changes the menu for the '/' command, replacing cryptic /^
and /" with /t and /T so that listing near traps or all traps is more
like listing near|all objects|monsters.  I put caret and double-quote
in as group accelerators; double-quote works on tty, caret gets
intercepted as "menu first page" so doesn't.  I didn't check other
interfaces since supporting that doesn't seem to be worth the bother.

Also a little bit of reformatting.
This commit is contained in:
PatR
2023-10-13 01:08:21 -07:00
parent d8bd1ddec0
commit 80b153638b
3 changed files with 70 additions and 26 deletions

View File

@@ -2900,8 +2900,8 @@ itemactions_pushkeys(struct obj *otmp, int act)
cmdq_add_key(CQ_CANNED, otmp->invlet);
break;
case IA_WHATIS_OBJ:
cmdq_add_ec(CQ_CANNED, dowhatis);
cmdq_add_key(CQ_CANNED, 'i');
cmdq_add_ec(CQ_CANNED, dowhatis); /* "/" command */
cmdq_add_key(CQ_CANNED, 'i'); /* "i" == item from inventory */
cmdq_add_key(CQ_CANNED, otmp->invlet);
break;
}
@@ -3193,7 +3193,9 @@ itemactions(struct obj *otmp)
ia_addmenu(win, IA_ZAP_OBJ, 'z', "Zap this wand to release its magic");
/* ?: Look up an item in the game's database */
ia_addmenu(win, IA_WHATIS_OBJ, '/', "Look up information about this item");
if (ia_checkfile(otmp))
ia_addmenu(win, IA_WHATIS_OBJ, '/',
"Look up information about this item");
Sprintf(buf, "Do what with %s?", the(cxname(otmp)));
end_menu(win, buf);