pickup: show container glyphs in tip/loot menus
doloot_core(), choose_tip_container_menu(), and tipcontainer_gettarget() each iterate carried or floor containers and offer them as menu rows, but passed &nul_glyphinfo so port windowports had nothing to render alongside. Compute proper glyph_info from each container the same way src/invent.c already does for inventory menus.
This commit is contained in:
+15
-6
@@ -2236,7 +2236,8 @@ doloot_core(void)
|
|||||||
|
|
||||||
if (num_conts > 1) {
|
if (num_conts > 1) {
|
||||||
/* use a menu to loot many containers */
|
/* use a menu to loot many containers */
|
||||||
int n, i;
|
int n, i, tmpglyph;
|
||||||
|
glyph_info tmpglyphinfo;
|
||||||
winid win;
|
winid win;
|
||||||
anything any;
|
anything any;
|
||||||
menu_item *pick_list = (menu_item *) 0;
|
menu_item *pick_list = (menu_item *) 0;
|
||||||
@@ -2249,7 +2250,9 @@ doloot_core(void)
|
|||||||
cobj = cobj->nexthere)
|
cobj = cobj->nexthere)
|
||||||
if (Is_container(cobj)) {
|
if (Is_container(cobj)) {
|
||||||
any.a_obj = cobj;
|
any.a_obj = cobj;
|
||||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
|
tmpglyph = obj_to_glyph(cobj, rn2_on_display_rng);
|
||||||
|
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
|
||||||
|
add_menu(win, &tmpglyphinfo, &any, 0, 0, ATR_NONE, clr,
|
||||||
doname(cobj), MENU_ITEMFLAGS_NONE);
|
doname(cobj), MENU_ITEMFLAGS_NONE);
|
||||||
}
|
}
|
||||||
end_menu(win, "Loot which containers?");
|
end_menu(win, "Loot which containers?");
|
||||||
@@ -3504,7 +3507,8 @@ tip_ok(struct obj *obj)
|
|||||||
staticfn int
|
staticfn int
|
||||||
choose_tip_container_menu(void)
|
choose_tip_container_menu(void)
|
||||||
{
|
{
|
||||||
int n, i;
|
int n, i, tmpglyph;
|
||||||
|
glyph_info tmpglyphinfo;
|
||||||
winid win;
|
winid win;
|
||||||
anything any;
|
anything any;
|
||||||
menu_item *pick_list = (menu_item *) 0;
|
menu_item *pick_list = (menu_item *) 0;
|
||||||
@@ -3520,7 +3524,9 @@ choose_tip_container_menu(void)
|
|||||||
if (Is_container(otmp)) {
|
if (Is_container(otmp)) {
|
||||||
++i;
|
++i;
|
||||||
any.a_obj = otmp;
|
any.a_obj = otmp;
|
||||||
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE,
|
tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng);
|
||||||
|
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
|
||||||
|
add_menu(win, &tmpglyphinfo, &any, 0, 0, ATR_NONE,
|
||||||
clr, doname(otmp), MENU_ITEMFLAGS_NONE);
|
clr, doname(otmp), MENU_ITEMFLAGS_NONE);
|
||||||
}
|
}
|
||||||
if (gi.invent) {
|
if (gi.invent) {
|
||||||
@@ -3872,7 +3878,8 @@ tipcontainer_gettarget(
|
|||||||
struct obj *box,
|
struct obj *box,
|
||||||
boolean *cancelled)
|
boolean *cancelled)
|
||||||
{
|
{
|
||||||
int n, n_conts;
|
int n, n_conts, tmpglyph;
|
||||||
|
glyph_info tmpglyphinfo;
|
||||||
winid win;
|
winid win;
|
||||||
anything any;
|
anything any;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
@@ -3923,7 +3930,9 @@ tipcontainer_gettarget(
|
|||||||
any = cg.zeroany;
|
any = cg.zeroany;
|
||||||
any.a_obj = !exclude_it ? otmp : 0;
|
any.a_obj = !exclude_it ? otmp : 0;
|
||||||
Sprintf(buf, "%s%s", !exclude_it ? "" : " ", doname(otmp));
|
Sprintf(buf, "%s%s", !exclude_it ? "" : " ", doname(otmp));
|
||||||
add_menu(win, &nul_glyphinfo, &any, !exclude_it ? otmp->invlet : 0, 0,
|
tmpglyph = obj_to_glyph(otmp, rn2_on_display_rng);
|
||||||
|
map_glyphinfo(0, 0, tmpglyph, 0U, &tmpglyphinfo);
|
||||||
|
add_menu(win, &tmpglyphinfo, &any, !exclude_it ? otmp->invlet : 0, 0,
|
||||||
ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE);
|
ATR_NONE, clr, buf, MENU_ITEMFLAGS_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user