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