diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 4c54efb8b..4547d4273 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -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 diff --git a/src/botl.c b/src/botl.c index a191e1be8..2bd11768c 100644 --- a/src/botl.c +++ b/src/botl.c @@ -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. */ @@ -892,7 +892,7 @@ status_finish() blstats[1][i].thresholds = blstats[0][i].thresholds; temp = next; } - } + } #endif /* STATUS_HILITES */ } } @@ -1317,7 +1317,7 @@ int newcolor; /* * get_hilite_color - * + * * Figures out, based on the value and the * direction it is moving, the color that the field * should be displayed in. @@ -1432,7 +1432,7 @@ int *colorptr; break; } hl = hl->next; - } + } } *colorptr = bestcolor; return; @@ -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++; } @@ -1763,12 +1769,12 @@ boolean from_configfile; up = TRUE; changed = TRUE; goto do_rel; - } else if (fld == BL_CAP + } else if (fld == BL_CAP && is_fld_arrayvalues(s[sidx], enc_stat, SLT_ENCUMBER, OVERLOADED+1, &kidx)) { txt = enc_stat[kidx]; txtval = TRUE; - goto do_rel; + goto do_rel; } else if (fld == BL_ALIGN && is_fld_arrayvalues(s[sidx], aligntxt, 0, 3, &kidx)) { txt = aligntxt[kidx]; @@ -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; @@ -1901,7 +1907,7 @@ do_rel: if (c >= CLR_MAX || coloridx != -1) return FALSE; coloridx = c; - } + } } if (coloridx == -1) coloridx = NO_COLOR; @@ -2125,7 +2131,7 @@ int sidx; if (!success) config_error_add("Missing condition(s)"); return success; - } + } Strcpy(buf, tmp); conditions_bitmask = str2conditionbitmask(buf); @@ -2199,7 +2205,7 @@ int sidx; if (k >= CLR_MAX) return FALSE; coloridx = k; - } + } } /* set the bits in the appropriate member of the condition array according to color chosen as index */ @@ -2227,7 +2233,7 @@ clear_status_hilites() blstats[1][i].thresholds = blstats[0][i].thresholds; temp = next; } - } + } } }