fix #K4324 - Xp and Exp highlit after restore

Experience-level and experience-points, if enabled, could be
highlighted via 'up' or 'changed' rules in initial display after
restore.  I tried 'down' rule too but didn't produce with that.

I don't understand what was going on but was able to reproduce it
and then fix it via the trial and error method....
This commit is contained in:
PatR
2025-03-16 19:37:40 -07:00
parent d53698baea
commit f7a390db11
2 changed files with 12 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 allmain.c $NHDT-Date: 1726894914 2024/09/21 05:01:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.261 $ */ /* NetHack 3.7 allmain.c $NHDT-Date: 1742207239 2025/03/17 02:27:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.275 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -687,7 +687,7 @@ init_sound_disp_gamewindows(void)
WIN_MESSAGE = create_nhwindow(NHW_MESSAGE); WIN_MESSAGE = create_nhwindow(NHW_MESSAGE);
if (VIA_WINDOWPORT()) { if (VIA_WINDOWPORT()) {
status_initialize(0); status_initialize(FALSE);
} else { } else {
WIN_STATUS = create_nhwindow(NHW_STATUS); WIN_STATUS = create_nhwindow(NHW_STATUS);
} }

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 botl.c $NHDT-Date: 1720397739 2024/07/08 00:15:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.264 $ */ /* NetHack 3.7 botl.c $NHDT-Date: 1742207239 2025/03/17 02:27:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.274 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1325,7 +1325,10 @@ eval_notify_windowport_field(
reset = FALSE; reset = FALSE;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
if (!gu.update_all && !chg && curr->time) { if (gu.update_all) {
chg = 0;
curr->time = prev->time = 0L;
} else if (!chg && curr->time) {
reset = hilite_reset_needed(prev, gb.bl_hilite_moves); reset = hilite_reset_needed(prev, gb.bl_hilite_moves);
if (reset) if (reset)
curr->time = prev->time = 0L; curr->time = prev->time = 0L;
@@ -1949,7 +1952,7 @@ static const struct fieldid_t {
{ "xp", BL_EXP }, { "xp", BL_EXP },
{ "exp", BL_EXP }, { "exp", BL_EXP },
{ "flags", BL_CONDITION }, { "flags", BL_CONDITION },
{0, BL_FLUSH } { NULL, BL_FLUSH }
}; };
/* format arguments */ /* format arguments */
@@ -2024,8 +2027,8 @@ status_eval_next_unhilite(void)
long next_unhilite, this_unhilite; long next_unhilite, this_unhilite;
gb.bl_hilite_moves = svm.moves; /* simplified; at one point we used to gb.bl_hilite_moves = svm.moves; /* simplified; at one point we used to
* try to encode fractional amounts for * try to encode fractional amounts for
* multiple moves within same turn */ * multiple moves within same turn */
/* figure out whether an unhilight needs to be performed now */ /* figure out whether an unhilight needs to be performed now */
next_unhilite = 0L; next_unhilite = 0L;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
@@ -2424,8 +2427,7 @@ has_ltgt_percentnumber(const char *str)
} }
/* splitsubfields(): splits str in place into '+' or '&' separated strings. /* splitsubfields(): splits str in place into '+' or '&' separated strings.
* returns number of strings, or -1 if more than maxsf or MAX_SUBFIELDS returns number of strings, or -1 if more than maxsf or MAX_SUBFIELDS */
*/
staticfn int staticfn int
splitsubfields(char *str, char ***sfarr, int maxsf) splitsubfields(char *str, char ***sfarr, int maxsf)
{ {
@@ -2575,7 +2577,7 @@ parse_status_hl2(char (*s)[QBUFSZ], boolean from_configfile)
/* Examples: /* Examples:
3.6.1: 3.6.1:
OPTION=hilite_status: hitpoints/<10%/red OPTION=hilite_status: hitpoints/<10%/red
OPTION=hilite_status: hitpoints/<10%/red/<5%/purple/1/red+blink+inverse OPTION=hilite_status: hitpoints/<10%/red/<5%/purple/1/red&blink+inverse
OPTION=hilite_status: experience/down/red/up/green OPTION=hilite_status: experience/down/red/up/green
OPTION=hilite_status: cap/strained/yellow/overtaxed/orange OPTION=hilite_status: cap/strained/yellow/overtaxed/orange
OPTION=hilite_status: title/always/blue OPTION=hilite_status: title/always/blue