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:
committed by
PatR
parent
284452796c
commit
880b7e3eef
@@ -2679,6 +2679,7 @@ enum item_action_actions {
|
|||||||
IA_WEAR_OBJ,
|
IA_WEAR_OBJ,
|
||||||
IA_SWAPWEAPON,
|
IA_SWAPWEAPON,
|
||||||
IA_ZAP_OBJ,
|
IA_ZAP_OBJ,
|
||||||
|
IA_WHATIS_OBJ, /* '/' specify inventory object */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* construct text for the menu entries for IA_NAME_OBJ and IA_NAME_OTYP */
|
/* 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_ec(CQ_CANNED, dozap);
|
||||||
cmdq_add_key(CQ_CANNED, otmp->invlet);
|
cmdq_add_key(CQ_CANNED, otmp->invlet);
|
||||||
break;
|
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)
|
if (otmp->oclass == WAND_CLASS)
|
||||||
ia_addmenu(win, IA_ZAP_OBJ, 'z', "Zap this wand to release its magic");
|
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)));
|
Sprintf(buf, "Do what with %s?", the(cxname(otmp)));
|
||||||
end_menu(win, buf);
|
end_menu(win, buf);
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -960,7 +960,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
|||||||
destroy_nhwindow(datawin), datawin = WIN_ERR;
|
destroy_nhwindow(datawin), datawin = WIN_ERR;
|
||||||
}
|
}
|
||||||
} else if (user_typed_name && pass == 0 && !pass1found_in_file)
|
} else if (user_typed_name && pass == 0 && !pass1found_in_file)
|
||||||
pline("I don't have any information on those things.");
|
pline("You don't have any information on those things.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto checkfile_done; /* skip error feedback */
|
goto checkfile_done; /* skip error feedback */
|
||||||
@@ -1450,6 +1450,7 @@ do_look(int mode, coord *click_cc)
|
|||||||
boolean quick = (mode == 1); /* use cursor; don't search for "more info" */
|
boolean quick = (mode == 1); /* use cursor; don't search for "more info" */
|
||||||
boolean clicklook = (mode == 2); /* right mouse-click method */
|
boolean clicklook = (mode == 2); /* right mouse-click method */
|
||||||
char out_str[BUFSZ] = DUMMY;
|
char out_str[BUFSZ] = DUMMY;
|
||||||
|
struct _cmd_queue cq, *cmdq;
|
||||||
const char *firstmatch = 0;
|
const char *firstmatch = 0;
|
||||||
struct permonst *pm = 0, *supplemental_pm = 0;
|
struct permonst *pm = 0, *supplemental_pm = 0;
|
||||||
int i = '\0', ans = 0;
|
int i = '\0', ans = 0;
|
||||||
@@ -1463,6 +1464,16 @@ do_look(int mode, coord *click_cc)
|
|||||||
cc.x = 0;
|
cc.x = 0;
|
||||||
cc.y = 0;
|
cc.y = 0;
|
||||||
|
|
||||||
|
if ((cmdq = cmdq_pop()) != 0) {
|
||||||
|
cq = *cmdq;
|
||||||
|
free((genericptr_t) cmdq);
|
||||||
|
if (cq.typ == CMDQ_KEY)
|
||||||
|
i = cq.key;
|
||||||
|
else
|
||||||
|
cmdq_clear(CQ_CANNED);
|
||||||
|
goto dowhatiscmd;
|
||||||
|
}
|
||||||
|
|
||||||
if (!clicklook) {
|
if (!clicklook) {
|
||||||
if (quick) {
|
if (quick) {
|
||||||
from_screen = TRUE; /* yes, we want to use the cursor */
|
from_screen = TRUE; /* yes, we want to use the cursor */
|
||||||
@@ -1533,6 +1544,7 @@ do_look(int mode, coord *click_cc)
|
|||||||
destroy_nhwindow(win);
|
destroy_nhwindow(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dowhatiscmd:
|
||||||
switch (i) {
|
switch (i) {
|
||||||
default:
|
default:
|
||||||
case 'q':
|
case 'q':
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 579 KiB |
Reference in New Issue
Block a user