more hilite_status threshold number parsing
In addition to leading '-' for negative values, accept explicit '+' for positive values as a no-op.
This commit is contained in:
+2
-1
@@ -12,7 +12,8 @@ list MSGTYPE values shows empty strings as reported in H7140
|
|||||||
Killing Vlad while he was in bat/fog cloud/wolf form gave poorly worded
|
Killing Vlad while he was in bat/fog cloud/wolf form gave poorly worded
|
||||||
feedback when he reverted to vampire form
|
feedback when he reverted to vampire form
|
||||||
spaces in hilite_status option title text field not working
|
spaces in hilite_status option title text field not working
|
||||||
numeric hilite_status values didn't allow negative numbers (needed for AC)
|
numeric hilite_status values didn't allow negative numbers (needed for AC);
|
||||||
|
change them to accept leading '-', also accept unary '+' as a no-op
|
||||||
|
|
||||||
|
|
||||||
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
+18
-17
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 botl.c $NHDT-Date: 1526597284 2018/05/17 22:48:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.93 $ */
|
/* NetHack 3.6 botl.c $NHDT-Date: 1526709371 2018/05/19 05:56:11 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.94 $ */
|
||||||
/* 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. */
|
||||||
@@ -1515,7 +1515,7 @@ boolean from_configfile;
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is str in the format of "[<>]?-?[0-9]+%?" regex */
|
/* is str in the format of "[<>]?[-+]?[0-9]+%?" regex */
|
||||||
STATIC_OVL boolean
|
STATIC_OVL boolean
|
||||||
is_ltgt_percentnumber(str)
|
is_ltgt_percentnumber(str)
|
||||||
const char *str;
|
const char *str;
|
||||||
@@ -1524,10 +1524,10 @@ const char *str;
|
|||||||
|
|
||||||
if (*s == '<' || *s == '>')
|
if (*s == '<' || *s == '>')
|
||||||
s++;
|
s++;
|
||||||
if (*s == '-')
|
if (*s == '-' || *s == '+')
|
||||||
s++;
|
s++;
|
||||||
/* note: this doesn't match the regexp shown above since it doesn't
|
if (!digit(*s))
|
||||||
require at least one digit; but it's adequate for how it gets used */
|
return FALSE;
|
||||||
while (digit(*s))
|
while (digit(*s))
|
||||||
s++;
|
s++;
|
||||||
if (*s == '%')
|
if (*s == '%')
|
||||||
@@ -1699,10 +1699,10 @@ boolean from_configfile;
|
|||||||
enum statusfields fld = BL_FLUSH;
|
enum statusfields fld = BL_FLUSH;
|
||||||
struct hilite_s hilite;
|
struct hilite_s hilite;
|
||||||
char tmpbuf[BUFSZ];
|
char tmpbuf[BUFSZ];
|
||||||
const char *aligntxt[] = {"chaotic", "neutral", "lawful"};
|
static const char *aligntxt[] = { "chaotic", "neutral", "lawful" };
|
||||||
/* hu_stat[] from eat.c has trailing spaces which foul up comparisons */
|
/* hu_stat[] from eat.c has trailing spaces which foul up comparisons */
|
||||||
const char *hutxt[] = {"Satiated", "", "Hungry", "Weak",
|
static const char *hutxt[] = { "Satiated", "", "Hungry", "Weak",
|
||||||
"Fainting", "Fainted", "Starved"};
|
"Fainting", "Fainted", "Starved" };
|
||||||
|
|
||||||
/* Examples:
|
/* Examples:
|
||||||
3.6.1:
|
3.6.1:
|
||||||
@@ -1737,7 +1737,7 @@ boolean from_configfile;
|
|||||||
return parse_condition(s, sidx);
|
return parse_condition(s, sidx);
|
||||||
|
|
||||||
++sidx;
|
++sidx;
|
||||||
while(s[sidx]) {
|
while (s[sidx]) {
|
||||||
char buf[BUFSZ], **subfields;
|
char buf[BUFSZ], **subfields;
|
||||||
int sf = 0; /* subfield count */
|
int sf = 0; /* subfield count */
|
||||||
int kidx;
|
int kidx;
|
||||||
@@ -1752,14 +1752,14 @@ boolean from_configfile;
|
|||||||
if (!s[sidx][0])
|
if (!s[sidx][0])
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
memset((genericptr_t) &hilite, 0, sizeof(struct hilite_s));
|
memset((genericptr_t) &hilite, 0, sizeof (struct hilite_s));
|
||||||
hilite.set = FALSE; /* mark it "unset" */
|
hilite.set = FALSE; /* mark it "unset" */
|
||||||
hilite.fld = fld;
|
hilite.fld = fld;
|
||||||
|
|
||||||
if (*s[sidx+1] == '\0' || !strcmpi(s[sidx], "always")) {
|
if (*s[sidx + 1] == '\0' || !strcmpi(s[sidx], "always")) {
|
||||||
/* "field/always/color" OR "field/color" */
|
/* "field/always/color" OR "field/color" */
|
||||||
always = TRUE;
|
always = TRUE;
|
||||||
if (*s[sidx+1] == '\0')
|
if (*s[sidx + 1] == '\0')
|
||||||
sidx--;
|
sidx--;
|
||||||
goto do_rel;
|
goto do_rel;
|
||||||
} else if (!strcmpi(s[sidx], "up") || !strcmpi(s[sidx], "down")) {
|
} else if (!strcmpi(s[sidx], "up") || !strcmpi(s[sidx], "down")) {
|
||||||
@@ -1771,7 +1771,8 @@ boolean from_configfile;
|
|||||||
goto do_rel;
|
goto do_rel;
|
||||||
} else if (fld == BL_CAP
|
} else if (fld == BL_CAP
|
||||||
&& is_fld_arrayvalues(s[sidx], enc_stat,
|
&& is_fld_arrayvalues(s[sidx], enc_stat,
|
||||||
SLT_ENCUMBER, OVERLOADED+1, &kidx)) {
|
SLT_ENCUMBER, OVERLOADED + 1,
|
||||||
|
&kidx)) {
|
||||||
txt = enc_stat[kidx];
|
txt = enc_stat[kidx];
|
||||||
txtval = TRUE;
|
txtval = TRUE;
|
||||||
goto do_rel;
|
goto do_rel;
|
||||||
@@ -1782,7 +1783,7 @@ boolean from_configfile;
|
|||||||
goto do_rel;
|
goto do_rel;
|
||||||
} else if (fld == BL_HUNGER
|
} else if (fld == BL_HUNGER
|
||||||
&& is_fld_arrayvalues(s[sidx], hutxt,
|
&& is_fld_arrayvalues(s[sidx], hutxt,
|
||||||
SATIATED, STARVED+1, &kidx)) {
|
SATIATED, STARVED + 1, &kidx)) {
|
||||||
txt = hu_stat[kidx]; /* store hu_stat[] val, not hutxt[] */
|
txt = hu_stat[kidx]; /* store hu_stat[] val, not hutxt[] */
|
||||||
txtval = TRUE;
|
txtval = TRUE;
|
||||||
goto do_rel;
|
goto do_rel;
|
||||||
@@ -1793,11 +1794,11 @@ boolean from_configfile;
|
|||||||
tmp = s[sidx];
|
tmp = s[sidx];
|
||||||
if (strchr(tmp, '%'))
|
if (strchr(tmp, '%'))
|
||||||
percent = TRUE;
|
percent = TRUE;
|
||||||
if (strchr(tmp, '<'))
|
if (*tmp == '<')
|
||||||
lt = TRUE;
|
lt = TRUE;
|
||||||
if (strchr(tmp, '>'))
|
else if (*tmp == '>')
|
||||||
gt = TRUE;
|
gt = TRUE;
|
||||||
(void) stripchars(tmpbuf, "%<>", tmp);
|
(void) stripchars(tmpbuf, "%<>+", tmp);
|
||||||
tmp = tmpbuf;
|
tmp = tmpbuf;
|
||||||
while (*tmp) {
|
while (*tmp) {
|
||||||
if (!index("0123456789", *tmp)
|
if (!index("0123456789", *tmp)
|
||||||
|
|||||||
Reference in New Issue
Block a user