status highlight fix for experience level

When I expanded the Guidebook's sample configuration file I added
several status_hilite options.  I decided that I'd better test what
was written and discovered that if Xp had an up or changed rule as
well as one or more percentage rules, it was showing bogus changes
whenever the integer value of the percentage changed.  The fix
turned out to be simple but it took a while to figure out.

I ultimately left the status_hilite settings out of the sample
options, because they tended to be too wide for Guidebook.txt's
formatting rather than because they weren't working as expected.
This commit is contained in:
PatR
2019-11-07 17:54:57 -08:00
parent 2058ad10f9
commit 6afb780d98
2 changed files with 12 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.166 $ $NHDT-Date: 1573172442 2019/11/08 00:20:42 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.167 $ $NHDT-Date: 1573178084 2019/11/08 01:54:44 $
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,
@@ -243,6 +243,8 @@ a recent intended sanity check fix inadvertently bypassed placing a thrown
chained ball back onto the floor
in symset:curses, symbol S_tree was accidentally set to horizontal line where
plus-or-minus sign was meant; also, change S_bars to not-equals sign
percentage highlighting for Xp broke up/down/changed highlighting for it;
it was flagged as having gone up every time the percentage changed
curses: sometimes the message window would show a blank line after a prompt
curses: the change to show map in columns 1..79 instead of 2..80 made the
highlight for '@' show up in the wrong place if clipped map had been

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.c $NHDT-Date: 1562114350 2019/07/03 00:39:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.146 $ */
/* NetHack 3.6 botl.c $NHDT-Date: 1573178085 2019/11/08 01:54:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.148 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -142,9 +142,9 @@ do_statusline2()
if (Upolyd)
Sprintf(expr, "HD:%d", mons[u.umonnum].mlevel);
else if (flags.showexp)
Sprintf(expr, "Xp:%u/%-1ld", u.ulevel, u.uexp);
Sprintf(expr, "Xp:%d/%-1ld", u.ulevel, u.uexp);
else
Sprintf(expr, "Exp:%u", u.ulevel);
Sprintf(expr, "Exp:%d", u.ulevel);
xln = strlen(expr);
/* time/move counter */
@@ -850,6 +850,12 @@ boolean *valsetlist;
if (anytype != ANY_MASK32) {
#ifdef STATUS_HILITES
if (chg || *curr->val) {
/* if Xp percentage changed, we set 'chg' to 1 above;
reset that if the Xp value hasn't actually changed
or possibly went down rather than up (level loss) */
if (chg == 1 && fld == BL_XP)
chg = compare_blstats(prev, curr);
curr->hilite_rule = get_hilite(idx, fld,
(genericptr_t) &curr->a,
chg, pc, &color);