From: nethack.allison Date: Wed, 13 Feb 2002 00:34:35 +0000 (+0000) Subject: menu tab tuning X-Git-Tag: MOVE2GIT~3188 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d9c97c57623e25994916fb15d0c4a9167f2aec3;p=nethack menu tab tuning --- diff --git a/src/cmd.c b/src/cmd.c index 6d1bafd80..678bda72d 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1048,6 +1048,7 @@ minimal_enlightenment() anything any; char buf[BUFSZ], buf2[BUFSZ]; static char fmtstr[] = "%-15s: %-12s"; + char deity_fmtstr[] = "%-17s%s"; any.a_void = 0; buf[0] = buf2[0] = '\0'; @@ -1099,7 +1100,7 @@ minimal_enlightenment() /* Deity list */ add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_BOLD, "Deities", FALSE); - Sprintf(buf2, "%-17s%s", align_gname(A_CHAOTIC), + Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC), (u.ualignbase[A_ORIGINAL] == u.ualign.type && u.ualign.type == A_CHAOTIC) ? " (s,c)" : (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)" : @@ -1107,7 +1108,7 @@ minimal_enlightenment() Sprintf(buf, fmtstr, "chaotic deity", buf2); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); - Sprintf(buf2, "%-17s%s", align_gname(A_NEUTRAL), + Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL), (u.ualignbase[A_ORIGINAL] == u.ualign.type && u.ualign.type == A_NEUTRAL) ? " (s,c)" : (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)" : @@ -1115,7 +1116,7 @@ minimal_enlightenment() Sprintf(buf, fmtstr, "neutral deity", buf2); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE); - Sprintf(buf2, "%-17s%s", align_gname(A_LAWFUL), + Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL), (u.ualignbase[A_ORIGINAL] == u.ualign.type && u.ualign.type == A_LAWFUL) ? " (s,c)" : (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)" : (u.ualign.type == A_LAWFUL) ? " (c)" : ""); diff --git a/src/options.c b/src/options.c index a01492b5b..905faf875 100644 --- a/src/options.c +++ b/src/options.c @@ -2196,7 +2196,7 @@ map_menu_cmd(ch) #endif static char fmtstr_doset_add_menu[] = "%s%-15s [%s] "; -static char fmtstr_doset_add_menu_tab[] = "%s\t%s\t[%s] "; +static char fmtstr_doset_add_menu_tab[] = "%s\t[%s]"; STATIC_OVL void doset_add_menu(win, option, indexoffset) @@ -2229,8 +2229,10 @@ doset_add_menu(win, option, indexoffset) } } /* " " replaces "a - " -- assumes menus follow that style */ - Sprintf(buf, iflags.menu_tab_sep ? fmtstr_doset_add_menu_tab : fmtstr_doset_add_menu, - any.a_int ? "" : iflags.menu_tab_sep ? "" : " ", option, value); + if (!iflags.menu_tab_sep) + Sprintf(buf, fmtstr_doset_add_menu, any.a_int ? "" : " ", option, value); + else + Sprintf(buf, fmtstr_doset_add_menu_tab, option, value); add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); } @@ -2274,8 +2276,7 @@ doset() pass == 0 ? " " : "", boolopt[i].name, *bool_p ? "true" : "false"); else - Sprintf(buf, "%s\t%s\t[%s]", - pass == 0 ? " " : "", + Sprintf(buf, "%s\t[%s]", boolopt[i].name, *bool_p ? "true" : "false"); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); diff --git a/src/spell.c b/src/spell.c index 6be70615b..03fb74863 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)spell.c 3.4 2002/01/19 */ +/* SCCS Id: @(#)spell.c 3.4 2002/02/12 */ /* Copyright (c) M. Stephenson 1988 */ /* NetHack may be freely redistributed. See license for details. */ @@ -998,10 +998,14 @@ int *spell_no; * To do it right would require that we implement columns * in the window-ports (say via a tab character). */ - Sprintf(buf, "%-20s Level %-12s Fail", " Name", "Category"); + if (!iflags.menu_tab_sep) + Sprintf(buf, "%-20s Level %-12s Fail", " Name", "Category"); + else + Sprintf(buf, "%-20s\tLevel\tCategory\tFail", "Name"); add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED); for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) { - Sprintf(buf, "%-20s %2d%s %-12s %3d%%", + Sprintf(buf, iflags.menu_tab_sep ? + "%s\t%2d%s\t%s\t%3d%%" : "%-20s %2d%s %-12s %3d%%", spellname(i), spellev(i), spellknow(i) ? " " : "*", spelltypemnemonic(spell_skilltype(spellid(i))),