]> granicus.if.org Git - nethack/commitdiff
stop tty hitpointbar from jumping to 100% health at zero hit points
authornhmall <nhmall@nethack.org>
Thu, 6 Sep 2018 00:21:59 +0000 (20:21 -0400)
committernhmall <nhmall@nethack.org>
Thu, 6 Sep 2018 00:21:59 +0000 (20:21 -0400)
doc/fixes36.2
win/tty/wintty.c

index c200e88f36dbc4ba0fc9273fa7eea41652a26ae1..82c475d0da8555d22c7e920e29385264d49ba19f 100644 (file)
@@ -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
index 5ad7a3dcce89842702f50a1d2951a1edc3dbcd7b..f41225f4b04545d864a24169d83fe954cef7b6f6 100644 (file)
@@ -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);