From 6afb780d98cf762d098165cf22f84bbc02e4a820 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 7 Nov 2019 17:54:57 -0800 Subject: [PATCH] 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. --- doc/fixes36.3 | 4 +++- src/botl.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index e71e94dba..d8c5ae5ce 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -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 diff --git a/src/botl.c b/src/botl.c index 4a856a211..4c7dbf33a 100644 --- a/src/botl.c +++ b/src/botl.c @@ -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);