Object lookup via inventory menu.

Adds an option to the inventory item menu which allows a user to
look up an item in the database. This uses the existing whatis
command.

A minor secondary change is switching the failed database lookup
message to second person. The use of a first person pronoun here
has always been very strange, and switching to second person centers
the player in the action.
This commit is contained in:
Kestrel Gregorich-Trevor
2023-10-03 10:50:22 -05:00
committed by PatR
parent 284452796c
commit 880b7e3eef
3 changed files with 22 additions and 1 deletions

View File

@@ -2679,6 +2679,7 @@ enum item_action_actions {
IA_WEAR_OBJ,
IA_SWAPWEAPON,
IA_ZAP_OBJ,
IA_WHATIS_OBJ, /* '/' specify inventory object */
};
/* construct text for the menu entries for IA_NAME_OBJ and IA_NAME_OTYP */
@@ -2898,6 +2899,11 @@ itemactions_pushkeys(struct obj *otmp, int act)
cmdq_add_ec(CQ_CANNED, dozap);
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_key(CQ_CANNED, otmp->invlet);
break;
}
}
@@ -3186,6 +3192,9 @@ itemactions(struct obj *otmp)
if (otmp->oclass == WAND_CLASS)
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");
Sprintf(buf, "Do what with %s?", the(cxname(otmp)));
end_menu(win, buf);