more !STATUS_HILITES

No point in checking for timed out temporary highlights if there aren't
any highlights.
This commit is contained in:
PatR
2019-04-09 17:45:32 -07:00
parent 2724c88191
commit 2e30f6916f
3 changed files with 49 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1554554180 2019/04/06 12:36:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.699 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1554857123 2019/04/10 00:45:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.700 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -159,13 +159,13 @@ E void NDECL(max_rank_sz);
E long NDECL(botl_score);
#endif
E int FDECL(describe_level, (char *));
E void NDECL(status_eval_next_unhilite);
E void FDECL(status_initialize, (BOOLEAN_P));
E void NDECL(status_finish);
E int NDECL(stat_cap_indx);
E int NDECL(stat_hunger_indx);
E const char *FDECL(bl_idx_to_fldname, (int));
#ifdef STATUS_HILITES
E void NDECL(status_eval_next_unhilite);
E void NDECL(reset_status_hilites);
E boolean FDECL(parse_status_hl1, (char *op, BOOLEAN_P));
E void FDECL(status_notify_windowport, (BOOLEAN_P));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 allmain.c $NHDT-Date: 1554591223 2019/04/06 22:53:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.97 $ */
/* NetHack 3.6 allmain.c $NHDT-Date: 1554857127 2019/04/10 00:45:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.98 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -320,7 +320,9 @@ boolean resuming;
/* once-per-hero-took-time things go here */
/******************************************/
#ifdef STATUS_HILITES
status_eval_next_unhilite();
#endif
if (context.bypasses)
clear_bypasses();
if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.c $NHDT-Date: 1554591223 2019/04/06 22:53:43 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */
/* NetHack 3.6 botl.c $NHDT-Date: 1554857126 2019/04/10 00:45:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.144 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -540,7 +540,9 @@ STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = {
struct istat_s blstats[2][MAXBLSTATS];
static boolean blinit = FALSE, update_all = FALSE;
static boolean valset[MAXBLSTATS];
#ifdef STATUS_HILITES
static long bl_hilite_moves = 0L;
#endif
/* we don't put this next declaration in #ifdef STATUS_HILITES.
* In the absence of STATUS_HILITES, each array
@@ -899,51 +901,6 @@ boolean *valsetlist;
update_all = FALSE;
}
/* called from moveloop(); sets context.botl if temp hilites have timed out */
void
status_eval_next_unhilite()
{
int i;
struct istat_s *curr;
long next_unhilite, this_unhilite;
bl_hilite_moves = moves; /* simpllfied; used to try to encode fractional
* amounts for multiple moves within same turn */
/* figure out whether an unhilight needs to be performed now */
next_unhilite = 0L;
for (i = 0; i < MAXBLSTATS; ++i) {
curr = &blstats[0][i]; /* blstats[0][*].time == blstats[1][*].time */
if (curr->chg) {
struct istat_s *prev = &blstats[1][i];
#ifdef STATUS_HILITES
if (Is_Temp_Hilite(curr->hilite_rule))
curr->time = prev->time = (bl_hilite_moves
+ iflags.hilite_delta);
else
curr->time = prev->time = 0L;
#endif
curr->chg = prev->chg = FALSE;
context.botl = TRUE;
}
if (context.botl)
continue; /* just process other blstats[][].time and .chg */
this_unhilite = curr->time;
if (this_unhilite > 0L
&& (next_unhilite == 0L || this_unhilite < next_unhilite)
#ifdef STATUS_HILITES
&& hilite_reset_needed(curr, this_unhilite + 1L)
#endif
) {
next_unhilite = this_unhilite;
if (next_unhilite < bl_hilite_moves)
context.botl = TRUE;
}
}
}
void
status_initialize(reassessment)
boolean reassessment; /* TRUE: just recheck fields w/o other initialization */
@@ -1436,6 +1393,47 @@ long augmented_time;
return TRUE;
}
/* called from moveloop(); sets context.botl if temp hilites have timed out */
void
status_eval_next_unhilite()
{
int i;
struct istat_s *curr;
long next_unhilite, this_unhilite;
bl_hilite_moves = moves; /* simpllfied; used to try to encode fractional
* amounts for multiple moves within same turn */
/* figure out whether an unhilight needs to be performed now */
next_unhilite = 0L;
for (i = 0; i < MAXBLSTATS; ++i) {
curr = &blstats[0][i]; /* blstats[0][*].time == blstats[1][*].time */
if (curr->chg) {
struct istat_s *prev = &blstats[1][i];
if (Is_Temp_Hilite(curr->hilite_rule))
curr->time = prev->time = (bl_hilite_moves
+ iflags.hilite_delta);
else
curr->time = prev->time = 0L;
curr->chg = prev->chg = FALSE;
context.botl = TRUE;
}
if (context.botl)
continue; /* just process other blstats[][].time and .chg */
this_unhilite = curr->time;
if (this_unhilite > 0L
&& (next_unhilite == 0L || this_unhilite < next_unhilite)
&& hilite_reset_needed(curr, this_unhilite + 1L)) {
next_unhilite = this_unhilite;
if (next_unhilite < bl_hilite_moves)
context.botl = TRUE;
}
}
}
/* called by options handling when 'statushilites' boolean is toggled */
void
reset_status_hilites()