Package: nethack-console
Version: 3.6.0-1
Severity: minor
Tags: patch

Dear Maintainer,

Two problems with HP monitor.

1. In a game with "hpmon" option enabled, if the bottom line look like below

  Dlvl:1  $:0  HP:14(16) Pw:2(2) AC:8  Exp:1

then "14(16)" should be green; further lower the HP, the color should turn
to yellow, then red and finally orange.

However in 3.6.0-1, in this case, the "(" in the "Pw:2(2)" have color and
change its color when HP changes. In some other case, the "(" may also lose
color; in some other case, the number between "Pw" and "(" may have color too.

I have recorded a case using script(1); if it is needed, I can send the
typescript file and timing file here.

After applied the attached patch and rebuilded the package, this
problem disappeared.

Possible cause: In 3.6.0 the gold symbol in the bottom line may be a encoded
glyph, so putmixed() is used to write the bottom line. But the code in the
HP monitor patch still use putstr() so that may cause the output incorrect.

2. In the options list displayed by the "O" command, "hpmon" option is
between "extmenu" and "fixinv". Since the option list is sorted, the correct
position of "hpmon" should be between "hilite_pile" and "ignintr".

The attached patch also contains a fix of this problem.

Regards,
Jun MO

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.4.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages nethack-console depends on:
ii  libc6           2.22-3
ii  libncurses5     6.0+20160213-1
ii  libtinfo5       6.0+20160213-1
ii  nethack-common  3.6.0-1

nethack-console recommends no packages.

nethack-console suggests no packages.

-- no debconf information
--- a/src/botl.c
+++ b/src/botl.c
@@ -100,7 +100,7 @@
             hp, hpmax, u.uen, u.uenmax, u.uac);
 #else
     curs(WIN_STATUS, 1, 1);
-    putstr(WIN_STATUS, 0, newbot2);
+    putmixed(WIN_STATUS, 0, newbot2);
 
     Sprintf(nb = eos(newbot2), "%d(%d)", hp, hpmax);
 #if defined(TEXTCOLOR) && !defined(LISP_GRAPHICS)
@@ -121,7 +121,7 @@
       if (hpcolor != NO_COLOR)
         term_start_color(hpcolor);
       if(hpattr!=ATR_NONE)term_start_attr(hpattr);
-      putstr(WIN_STATUS, hpattr, newbot2);
+      putmixed(WIN_STATUS, hpattr, newbot2);
       if(hpattr!=ATR_NONE)term_end_attr(hpattr);
       if (hpcolor != NO_COLOR)
         term_end_color();
--- a/src/options.c
+++ b/src/options.c
@@ -112,9 +112,6 @@
 #else
     { "extmenu", (boolean *) 0, FALSE, SET_IN_FILE },
 #endif
-#if defined(TEXTCOLOR) && defined(HPMON)
-        { "hpmon", &iflags.use_hpmon, FALSE, SET_IN_GAME},
-#endif
 #ifdef OPT_DISPMAP
     { "fast_map", &flags.fast_map, TRUE, SET_IN_GAME },
 #else
@@ -131,6 +128,9 @@
     { "help", &flags.help, TRUE, SET_IN_GAME },
     { "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/
     { "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME },
+#if defined(TEXTCOLOR) && defined(HPMON)
+    { "hpmon", &iflags.use_hpmon, FALSE, SET_IN_GAME},
+#endif
 #ifndef MAC
     { "ignintr", &flags.ignintr, FALSE, SET_IN_GAME },
 #else

Reply via email to