From: PatR Date: Thu, 6 Sep 2018 12:26:21 +0000 (-0700) Subject: hilite_status type 'up' or 'down' vs strings X-Git-Tag: NetHack-3.6.2_Released~201^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ce6d81d60256a6cd17ea72198c6473aa60bb2f7;p=nethack hilite_status type 'up' or 'down' vs strings The temporary highlight types 'goes-up' and 'goes-down' aren't useful for the three string status fields (title, dungeon-level, alignment) since the string values might go up when the underlying value goes up or might go down instead (and similarly for down, down, up). The code involved can compare strings but the values are effectively arbitrary so the comparison is only really useful for same vs changed. This treats types 'up' and 'down' for strings as 'changed' when coming from config file and no longer offers them as choices when using 'O'. Config file parsing perhaps ought to treat them as errors instead. --- diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 82c475d0d..949691dad 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -111,6 +111,9 @@ add window port status_update() value BL_RESET to use as a flag to redraw all status fields, distinguished from BL_FLUSH which now only specifies that the bot() call has completed so any buffered changes should now be rendered +for hilite_status of string status fields (title, dungeon-level, alignment), + the types value-goes-up and -down aren't meaningful; treat them as + value-changed if from config file and don't offer as choices with 'O' Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository @@ -166,7 +169,7 @@ sortloot option has been enhanced to improve object ordering; primarily, items of undiscovered type come out before items of discovered type within each class or sub-class of objects YAFM when stumbling on an undetected monster while hallucinating -Make it clear when a leprechaun dodges your attack +make it clear when a leprechaun dodges your attack wizard mode #wizidentify can now select individual items for permanent identification and don't display the selection to permanently identify everything if everything is already fully identified diff --git a/src/botl.c b/src/botl.c index 784438a14..8ffe73c5e 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1851,7 +1851,13 @@ boolean from_configfile; if (*s[sidx + 1] == '\0') sidx--; } else if (!strcmpi(s[sidx], "up") || !strcmpi(s[sidx], "down")) { - if (!strcmpi(s[sidx], "down")) + if (initblstats[fld].anytype == ANY_STR) + /* ordered string comparison is supported but LT/GT for + the string fields (title, dungeon-level, alignment) + is pointless; treat 'up' or 'down' for string fields + as 'changed' rather than rejecting them outright */ + ; + else if (!strcmpi(s[sidx], "down")) down = TRUE; else up = TRUE; @@ -2054,8 +2060,6 @@ boolean from_configfile; return TRUE; } - - const struct condmap valid_conditions[] = { {"stone", BL_MASK_STONE}, {"slime", BL_MASK_SLIME}, @@ -3039,12 +3043,22 @@ choose_value: hilite.rel = lt_gt_eq; hilite.value = aval; } else if (behavior == BL_TH_UPDOWN) { - boolean ltok = (fld != BL_TIME), gtok = TRUE; + if (initblstats[fld].anytype != ANY_STR) { + boolean ltok = (fld != BL_TIME), gtok = TRUE; - lt_gt_eq = status_hilite_menu_choose_updownboth(fld, (char *)0, - ltok, gtok); - if (lt_gt_eq == NO_LTEQGT) - goto choose_behavior; + lt_gt_eq = status_hilite_menu_choose_updownboth(fld, (char *)0, + ltok, gtok); + if (lt_gt_eq == NO_LTEQGT) + goto choose_behavior; + } else { /* ANY_STR */ + /* player picked ' value changes' in outer menu; + ordered string comparison is supported but LT/GT for the + string status fields (title, dungeon level, alignment) + is pointless; rather than calling ..._choose_updownboth() + with ltok==False plus gtok=False and having a menu with a + single choice, skip it altogether and just use 'changed' */ + lt_gt_eq = EQ_VALUE; + } Sprintf(colorqry, "Choose a color for when %s %s:", initblstats[fld].fldname, (lt_gt_eq == EQ_VALUE) ? "changes"