Simplify add_menu, part 5

This commit is contained in:
Pasi Kallinen
2023-11-03 21:41:26 +02:00
parent 175d167896
commit 93fd946ff6
2 changed files with 8 additions and 23 deletions

View File

@@ -114,14 +114,8 @@ static struct ll_achieve_msg achieve_msg [] = {
static void
enlght_out(const char *buf)
{
int clr = 0;
if (ge.en_via_menu) {
anything any;
any = cg.zeroany;
add_menu(ge.en_win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf,
MENU_ITEMFLAGS_NONE);
add_menu_str(ge.en_win, buf);
} else
putstr(ge.en_win, 0, buf);
}

View File

@@ -3412,12 +3412,10 @@ display_pickinv(
Sprintf(eos(prompt),
" -- unidentified or partially identified item%s",
plur(unid_cnt));
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, prompt,
MENU_ITEMFLAGS_NONE);
add_menu_str(win, prompt);
if (!unid_cnt) {
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
"(all items are permanently identified already)",
MENU_ITEMFLAGS_NONE);
add_menu_str(win,
"(all items are permanently identified already)");
gotsomething = TRUE;
} else {
any.a_obj = &wizid_fakeobj;
@@ -3522,12 +3520,10 @@ display_pickinv(
there isn't anything applicable to list; the n==0 case above
gets skipped for perm_invent), put something into the menu */
if (iflags.perm_invent && !lets && !gotsomething) {
any = cg.zeroany;
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
add_menu_str(win,
(inuse_only && skipped_noninuse) ? not_using_anything
: (!show_gold && skipped_gold) ? only_carrying_gold
: not_carrying_anything,
MENU_ITEMFLAGS_NONE);
: not_carrying_anything);
want_reply = FALSE;
}
#ifdef TTY_PERM_INVENT
@@ -5353,18 +5349,13 @@ static void
invdisp_nothing(const char *hdr, const char *txt)
{
winid win;
anything any;
menu_item *selected;
int clr = 0;
any = cg.zeroany;
win = create_nhwindow(NHW_MENU);
start_menu(win, MENU_BEHAVE_STANDARD);
add_menu_heading(win, hdr);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr,
"", MENU_ITEMFLAGS_NONE);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, txt,
MENU_ITEMFLAGS_NONE);
add_menu_str(win, "");
add_menu_str(win, txt);
end_menu(win, (char *) 0);
if (select_menu(win, PICK_NONE, &selected) > 0)
free((genericptr_t) selected);