fix 'up' and 'down' status highlighting for HP

If there was a status_hilite rule for hitpoints:up, it got used for
both up and down changes.  If there was one for hitpoints:down, it got
ignored even if there was no 'up' rule.  The flag for which direction
the value changed was always positive even when the value went down.

I'm reasonably sure that at some point HP up/down worked correctly.
This problem was present in 3.6.4; I didn't go back any farther.
This commit is contained in:
PatR
2023-08-05 12:50:47 -07:00
parent 9907d4c59e
commit 9f16eaa0a5
2 changed files with 6 additions and 4 deletions

View File

@@ -1225,6 +1225,8 @@ allow #sit while flying over a squeaky board trap to trigger it
weight of statues of wraiths and of monsters which never leave a corpse was 0
when a werecreature in human form attacked hero, it could transform to critter
despite hero having the Protection_from_shape_changers_attibute
status highlighting for hit points didn't work as intended for up or down HP
changes; 'up' rule was used for both, 'down' rule was ignored
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -1222,7 +1222,7 @@ eval_notify_windowport_field(int fld, boolean *valsetlist, int idx)
? percentage(curr, &gb.blstats[idx][fldmax])
: 0; /* bullet proofing; can't get here */
if (pc != prev->percent_value)
chg = 1;
chg = (pc < prev->percent_value) ? -1 : 1;
curr->percent_value = pc;
} else {
pc = 0;
@@ -1473,7 +1473,7 @@ init_blstats(void)
*
*/
static int
compare_blstats(struct istat_s *bl1, struct istat_s*bl2)
compare_blstats(struct istat_s *bl1, struct istat_s *bl2)
{
int anytype, result = 0;
@@ -1484,8 +1484,8 @@ compare_blstats(struct istat_s *bl1, struct istat_s*bl2)
anytype = bl1->anytype;
if ((!bl1->a.a_void || !bl2->a.a_void)
&& (anytype == ANY_IPTR || anytype == ANY_UPTR || anytype == ANY_LPTR
|| anytype == ANY_ULPTR)) {
&& (anytype == ANY_IPTR || anytype == ANY_UPTR
|| anytype == ANY_LPTR || anytype == ANY_ULPTR)) {
panic("compare_blstat: invalid pointer %s, %s",
fmt_ptr((genericptr_t) bl1->a.a_void),
fmt_ptr((genericptr_t) bl2->a.a_void));