diff --git a/doc/fixes36.3 b/doc/fixes36.3 index b3c2dcead..b787a3c1e 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.142 $ $NHDT-Date: 1571435999 2019/10/18 21:59:59 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.143 $ $NHDT-Date: 1571448220 2019/10/19 01:23:40 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -357,6 +357,7 @@ status highlighting using percentage rules now supported for experience level the start of the current Xp level to the start of the next Xp level; 100% isn't possible so used as special case for next_Xp_lvl - 1 Exp_pt wizard-mode: display effect to show where an unseen wished-for monster landed +for 'O's symset and roguesymset menus, mark current symbol set as preselected curses: enable latent mouse support curses: give menus and text windows a minimum size of 5x25 since tiny ones can sometimes be overlooked when shown over old messages rather than map diff --git a/src/options.c b/src/options.c index ddbe794f8..f4975688a 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1571347977 2019/10/17 21:32:57 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.379 $ */ +/* NetHack 3.6 options.c $NHDT-Date: 1571448220 2019/10/19 01:23:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.380 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -784,9 +784,9 @@ initoptions_init() */ /* this detects the IBM-compatible console on most 386 boxes */ if ((opts = nh_getenv("TERM")) && !strncmp(opts, "AT", 2)) { - if (!symset[PRIMARY].name) + if (!symset[PRIMARY].explicitly) load_symset("IBMGraphics", PRIMARY); - if (!symset[ROGUESET].name) + if (!symset[ROGUESET].explicitly) load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); #ifdef TEXTCOLOR @@ -801,7 +801,7 @@ initoptions_init() /* [could also check "xterm" which emulates vtXXX by default] */ && !strncmpi(opts, "vt", 2) && AS && AE && index(AS, '\016') && index(AE, '\017')) { - if (!symset[PRIMARY].name) + if (!symset[PRIMARY].explicitly) load_symset("DECGraphics", PRIMARY); switch_symbols(TRUE); } @@ -810,15 +810,13 @@ initoptions_init() #if defined(MSDOS) || defined(WIN32) /* Use IBM defaults. Can be overridden via config file */ - if (!symset[PRIMARY].name) { + if (!symset[PRIMARY].explicitly) load_symset("IBMGraphics_2", PRIMARY); - } - if (!symset[ROGUESET].name) { + if (!symset[ROGUESET].explicitly) load_symset("RogueEpyx", ROGUESET); - } #endif #ifdef MAC_GRAPHICS_ENV - if (!symset[PRIMARY].name) + if (!symset[PRIMARY].explicitly) load_symset("MACGraphics", PRIMARY); switch_symbols(TRUE); #endif /* MAC_GRAPHICS_ENV */ @@ -5368,7 +5366,7 @@ boolean setinitial, setfromfile; nothing_to_do = FALSE; char *symset_name, fmtstr[20]; struct symsetentry *sl; - int res, which_set, setcount = 0, chosen = -2; + int res, which_set, setcount = 0, chosen = -2, defindx = 0; which_set = rogueflag ? ROGUESET : PRIMARY; symset_list = (struct symsetentry *) 0; @@ -5451,9 +5449,13 @@ boolean setinitial, setfromfile; #else nhUse(big_desc); #endif - any.a_int = 1; + any.a_int = 1; /* -1 + 2 [see 'if (sl->name) {' below]*/ + if (!symset_name) + defindx = any.a_int; add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - "Default Symbols", MENU_UNSELECTED); + "Default Symbols", + (any.a_int == defindx) ? MENU_SELECTED + : MENU_UNSELECTED); for (sl = symset_list; sl; sl = sl->next) { /* check restrictions */ @@ -5463,20 +5465,34 @@ boolean setinitial, setfromfile; if (sl->handling == H_MAC) continue; #endif - if (sl->name) { + /* +2: sl->idx runs from 0 to N-1 for N symsets; + +1 because Defaults are implicitly in slot [0]; + +1 again so that valid data is never 0 */ any.a_int = sl->idx + 2; + if (symset_name && !strcmpi(sl->name, symset_name)) + defindx = any.a_int; Sprintf(buf, fmtstr, sl->name, sl->desc ? sl->desc : ""); - add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, - buf, MENU_UNSELECTED); + add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, + (any.a_int == defindx) ? MENU_SELECTED + : MENU_UNSELECTED); } } Sprintf(buf, "Select %ssymbol set:", rogueflag ? "rogue level " : ""); end_menu(tmpwin, buf); - if (select_menu(tmpwin, PICK_ONE, &symset_pick) > 0) { - chosen = symset_pick->item.a_int - 2; + n = select_menu(tmpwin, PICK_ONE, &symset_pick); + if (n > 0) { + chosen = symset_pick[0].item.a_int; + /* if picking non-preselected entry yields 2, make sure + that we're going with the non-preselected one */ + if (n == 2 && chosen == defindx) + chosen = symset_pick[1].item.a_int; + chosen -= 2; /* convert menu index to symset index; + * "Default symbols" have index -1 */ free((genericptr_t) symset_pick); + } else if (n == 0 && defindx > 0) { + chosen = defindx - 2; } destroy_nhwindow(tmpwin);