fix #H7160 - hilite thresholds reject negatives

There was a prior report about this but I can't find it; maybe it
didn't go through the web contact form.  Anyway, status_hilite
threshold numeric values wouldn't accept a minus sign before the
digits, preventing negative AC values from being tracked.
This commit is contained in:
PatR
2018-05-17 15:48:09 -07:00
parent 1641409d1c
commit 4b98266e25
2 changed files with 34 additions and 27 deletions
+9 -8
View File
@@ -9,9 +9,10 @@ General Fixes and Modified Features
-----------------------------------
last line of config file wasn't being heeded if it had no newline
list MSGTYPE values shows empty strings as reported in H7140
Killing Vlad while he was in bat/fog cloud/wolf form gave poorly
worded feedback when he reverted to vampire form
Killing Vlad while he was in bat/fog cloud/wolf form gave poorly worded
feedback when he reverted to vampire form
spaces in hilite_status option title text field not working
numeric hilite_status values didn't allow negative numbers (needed for AC)
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
@@ -25,11 +26,11 @@ windows-gui: In nethackw, there could be conflicts between menu accelerators
and an extra choice accelerator to fix H7132.
windows-tty: Specify both width and height when creating font for width testing
windows-tty: To counter lag problems that were occuring with the Win32 console
port, implement a console back buffer to reduce the number of calls made to
WriteConsoleOutputXXX
windows-tty: Additional changes to xputc_core() and early_raw_print() to manage
the cursor position correctly as that is needed to handle raw printing
correctly
port, implement a console back buffer to reduce the number of calls
made to WriteConsoleOutputXXX
windows-tty: Additional changes to xputc_core() and early_raw_print() to
manage the cursor position correctly as that is needed to handle
raw printing correctly
windows-tty: Added check for when we might be running off the bottom of the
screen when handling msmsg()
windows-tty: Added runtime checks to keep cursor always within bounds
@@ -38,7 +39,7 @@ windows-tty: Use nhraykey by default if the players keyboard layout is
non-english as reported in H4216
windows-tty: We now support changing altkeyhandler in game
windows: Added ntassert() mechanism for Windows based port use
tty: some optimizations for performance and per field rendering
tty: significant optimizations for performance and per field rendering
General New Features
+16 -10
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.c $NHDT-Date: 1526427319 2018/05/15 23:35:19 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.92 $ */
/* NetHack 3.6 botl.c $NHDT-Date: 1526597284 2018/05/17 22:48:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.93 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1515,17 +1515,23 @@ boolean from_configfile;
return TRUE;
}
/* is str in the format of "(<>)?[0-9]+%?" regex */
/* is str in the format of "[<>]?-?[0-9]+%?" regex */
STATIC_OVL boolean
is_ltgt_percentnumber(str)
const char *str;
{
const char *s = str;
if (*s == '<' || *s == '>') s++;
while (digit(*s)) s++;
if (*s == '%') s++;
if (*s == '<' || *s == '>')
s++;
if (*s == '-')
s++;
/* note: this doesn't match the regexp shown above since it doesn't
require at least one digit; but it's adequate for how it gets used */
while (digit(*s))
s++;
if (*s == '%')
s++;
return (*s == '\0');
}
@@ -1537,7 +1543,7 @@ const char *str;
const char *s = str;
while (*s) {
if (!index("<>0123456789%", *s))
if (!index("<>-0123456789%", *s))
return FALSE;
s++;
}
@@ -1794,7 +1800,8 @@ boolean from_configfile;
(void) stripchars(tmpbuf, "%<>", tmp);
tmp = tmpbuf;
while (*tmp) {
if (!index("0123456789", *tmp))
if (!index("0123456789", *tmp)
&& (*tmp != '-' || tmp > tmpbuf))
return FALSE;
tmp++;
}
@@ -1842,8 +1849,7 @@ do_rel:
else
hilite.rel = LT_VALUE;
if (initblstats[fld].anytype == ANY_STR
&& (percent || numeric)) {
if (initblstats[fld].anytype == ANY_STR && (percent || numeric)) {
config_error_add("Field '%s' does not support numeric values",
initblstats[fld].fldname);
return FALSE;