Simplify add_menu, part 4

This commit is contained in:
Pasi Kallinen
2023-11-03 21:27:22 +02:00
parent 7592ce81f4
commit 175d167896

View File

@@ -3735,9 +3735,7 @@ print_mapseen(
buf[i] = highc(buf[i]); buf[i] = highc(buf[i]);
/* capitalizing it makes it a sentence; terminate with '.' */ /* capitalizing it makes it a sentence; terminate with '.' */
Strcat(buf, "."); Strcat(buf, ".");
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
} }
/* we assume that these are mutually exclusive */ /* we assume that these are mutually exclusive */
@@ -3774,16 +3772,12 @@ print_mapseen(
Sprintf(buf, "%sMoloch's Sanctum.", PREFIX); Sprintf(buf, "%sMoloch's Sanctum.", PREFIX);
} }
if (*buf) { if (*buf) {
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
} }
/* quest entrance is not mutually-exclusive with bigroom or rogue level */ /* quest entrance is not mutually-exclusive with bigroom or rogue level */
if (mptr->flags.quest_summons) { if (mptr->flags.quest_summons) {
Sprintf(buf, "%sSummoned by %s.", PREFIX, ldrname()); Sprintf(buf, "%sSummoned by %s.", PREFIX, ldrname());
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
} }
/* print out branches */ /* print out branches */
@@ -3798,9 +3792,7 @@ print_mapseen(
if (mptr->br->end1_up && !In_endgame(&(mptr->br->end2))) if (mptr->br->end1_up && !In_endgame(&(mptr->br->end2)))
Sprintf(eos(buf), ", level %d", depth(&(mptr->br->end2))); Sprintf(eos(buf), ", level %d", depth(&(mptr->br->end2)));
Strcat(buf, "."); Strcat(buf, ".");
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
} }
/* maybe print out bones details */ /* maybe print out bones details */
@@ -3813,9 +3805,7 @@ print_mapseen(
++kncnt; ++kncnt;
if (kncnt) { if (kncnt) {
Sprintf(buf, "%s%s", PREFIX, "Final resting place for"); Sprintf(buf, "%s%s", PREFIX, "Final resting place for");
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
if (died_here) { if (died_here) {
/* disclosure occurs before bones creation, so listing dead /* disclosure occurs before bones creation, so listing dead
hero here doesn't give away whether bones are produced */ hero here doesn't give away whether bones are produced */
@@ -3827,18 +3817,13 @@ print_mapseen(
(void) strsubst(tmpbuf, " her ", " your "); (void) strsubst(tmpbuf, " her ", " your ");
Snprintf(buf, sizeof(buf), "%s%syou, %s%c", PREFIX, TAB, Snprintf(buf, sizeof(buf), "%s%syou, %s%c", PREFIX, TAB,
tmpbuf, --kncnt ? ',' : '.'); tmpbuf, --kncnt ? ',' : '.');
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
} }
for (bp = mptr->final_resting_place; bp; bp = bp->next) { for (bp = mptr->final_resting_place; bp; bp = bp->next) {
if (bp->bonesknown || wizard || final > 0) { if (bp->bonesknown || wizard || final > 0) {
Sprintf(buf, "%s%s%s, %s%c", PREFIX, TAB, bp->who, Sprintf(buf, "%s%s%s, %s%c", PREFIX, TAB, bp->who,
bp->how, --kncnt ? ',' : '.'); bp->how, --kncnt ? ',' : '.');
any = cg.zeroany; add_menu_str(win, buf);
add_menu(win, &nul_glyphinfo, &any, 0, 0,
ATR_NONE, NO_COLOR,
buf, MENU_ITEMFLAGS_NONE);
} }
} }
} }