status hilites: Hp and Pw percentages

The hitpoints and power/energy status values (and corresponding
maxima) shown on the screen are capped at 9999 to control status line
width.  The actual values can be bigger than that.  Highlights based
on percentages were doing their calculations on the potentially
truncated values rather than on the actual ones.

Add another field to the blstat[] structure, populate it for BL_HP,
BL_HPMAX, BL_ENE, and BL_EXEMAX and switch to it for their percentage
calculations.

Doesn't seem to break highlighting of 'normal' range values but hasn't
been tested for extreme ones.
This commit is contained in:
PatR
2023-09-16 12:42:26 -07:00
parent 1958daef4c
commit 2a5f03a3b4
2 changed files with 52 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 botl.h $NHDT-Date: 1596498528 2020/08/03 23:48:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.34 $ */
/* NetHack 3.7 botl.h $NHDT-Date: 1694893330 2023/09/16 19:42:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.37 $ */
/* Copyright (c) Michael Allison, 2003 */
/* NetHack may be freely redistributed. See license for details. */
@@ -255,7 +255,7 @@ struct istat_s {
boolean percent_matters;
short percent_value;
unsigned anytype;
anything a;
anything a, rawval;
char *val;
int valwidth;
enum statusfields idxmax;