boolean option processing

In addition to 'true', 'yes', 'on' and 'false', 'no', 'off',
accept 1 and 0 for the value of a boolean option.  Other numeric
values are rejected rather than treated as non-zero.

Relax the parsing for true, false, yes, no to accept one or more
letters instead of requiring at least three for true and false
and full word for yes and no.  Full word is still required for
on and off.

Don't report two errors for the same mistake:
 |% NETHACKOPTIONS='legacy:flase' ./nethack
 | * Illegal parameter for a boolean.
 | * Unknown option 'legacy:flase'.
 |2 errors in NETHACKOPTIONS.
is changed to
 | * 'legacy:flase' is not valid for a boolean.
 |1 error in NETHACKOPTIONS.
This commit is contained in:
PatR
2020-09-09 14:19:48 -07:00
parent d3181e20ba
commit e9df383bd6
2 changed files with 32 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.299 $ $NHDT-Date: 1599559379 2020/09/08 10:02:59 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.300 $ $NHDT-Date: 1599686385 2020/09/09 21:19:45 $
General Fixes and Modified Features
-----------------------------------
@@ -507,7 +507,7 @@ new monsters: displacer beast ('f') and genetic engineer ('Q')
make camera flash which reveals previously unseen map features or objects or
monsters record those on the hero's map; monsters revert to 'unseen'
boolean options can optionally have the form "name:value" with value taken
from among "true", "yes", "on", or "false", "no", "off"
from among "true", "yes", "on", or 1 and "false", "no", "off", or 0
record number of wishes and artifact wishes in xlogfile
give feedback for '#chat' directed at walls
add 'Sokoban' conduct, tracking the number of times the special Sokoban rules