From ec43a80e9e05235cf8fefa506f0195387c6a000c Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 5 Sep 2018 20:21:59 -0400 Subject: [PATCH 1/4] stop tty hitpointbar from jumping to 100% health at zero hit points --- doc/fixes36.2 | 1 + win/tty/wintty.c | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index c200e88f3..82c475d0d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -146,6 +146,7 @@ windows: Added ntassert() mechanism for Windows based port use tty: significant optimizations for performance and per field rendering tty: use WC2_FLUSH_STATUS to buffer changes until BL_FLUSH is received tty: support BL_RESET in status_update to force an update to all status fields +tty: stop hitpointbar from jumping to 100% health at zero hit points unix: Makefile.src and Makefile.utl inadvertently relied on a 'gnu make' extension when using $(VERBOSEMAKE) to reduce build-time feedback; replace with $(QUIETCC) which operates the same but defaults to diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 5ad7a3dcc..f41225f4b 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintty.c $NHDT-Date: 1526909614 2018/05/21 13:33:34 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.167 $ */ +/* NetHack 3.6 wintty.c $NHDT-Date: 1536193253 2018/09/06 00:20:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.170 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -4245,15 +4245,20 @@ render_status(VOID_ARGS) } if (iflags.hilite_delta) { tty_putstatusfield(nullfield, "[", x++, y); - if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) - term_start_color(hpbar_color); - term_start_attr(ATR_INVERSE); - tty_putstatusfield(nullfield, bar, x, y); + if (hpbar_percent > 0) { + if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) + term_start_color(hpbar_color); + term_start_attr(ATR_INVERSE); + } + tty_putstatusfield(nullfield, + (hpbar_percent > 0) ? bar : text, x, y); x += (int) strlen(bar); - term_end_attr(ATR_INVERSE); - if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) - term_end_color(); - if (twoparts) { + if (hpbar_percent > 0) { + term_end_attr(ATR_INVERSE); + if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) + term_end_color(); + } + if (twoparts && hpbar_percent > 0) { *bar2 = savedch; tty_putstatusfield(nullfield, bar2, x, y); x += (int) strlen(bar2); From c00b698b4a9ae818b554fe7aa16f3661395c7163 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 5 Sep 2018 20:47:16 -0400 Subject: [PATCH 2/4] hitpointbar bit for prior commit --- win/tty/wintty.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index f41225f4b..6e0214911 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 wintty.c $NHDT-Date: 1536193253 2018/09/06 00:20:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.170 $ */ +/* NetHack 3.6 wintty.c $NHDT-Date: 1526909614 2018/05/21 13:33:34 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.167 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -4244,15 +4244,17 @@ render_status(VOID_ARGS) } } if (iflags.hilite_delta) { + char *s = bar; tty_putstatusfield(nullfield, "[", x++, y); if (hpbar_percent > 0) { if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) term_start_color(hpbar_color); term_start_attr(ATR_INVERSE); } - tty_putstatusfield(nullfield, - (hpbar_percent > 0) ? bar : text, x, y); - x += (int) strlen(bar); + if (hpbar_percent == 0) + s = text; + tty_putstatusfield(nullfield, s, x, y); + x += (int) strlen(s); if (hpbar_percent > 0) { term_end_attr(ATR_INVERSE); if (hpbar_color != NO_COLOR && coloridx != CLR_MAX) From 4ce6d81d60256a6cd17ea72198c6473aa60bb2f7 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 6 Sep 2018 05:26:21 -0700 Subject: [PATCH 3/4] 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. --- doc/fixes36.2 | 5 ++++- src/botl.c | 30 ++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) 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" From 533234f13d92ddc7514fcc203677f549b8ee2693 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 6 Sep 2018 16:28:42 -0700 Subject: [PATCH 4/4] arg type mismatch This was right in 3.4.3 but got changed way back in 2004. No effect on play and unlikely to be complained about by any compiler. --- src/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd.c b/src/cmd.c index d73d0e60e..b5c6ee1a2 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2486,7 +2486,7 @@ int final; else if (u.moreluck < 0) you_have("reduced luck", ""); if (carrying(LUCKSTONE) || stone_luck(TRUE)) { - ltmp = stone_luck(0); + ltmp = stone_luck(FALSE); if (ltmp <= 0) enl_msg("Bad luck ", "does", "did", " not time out for you", ""); if (ltmp >= 0)