diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 4c55bc680..92e097380 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -55,6 +55,7 @@ make travel walk up to a trap and stop when the trap blocks the only travel will displace pets rather than stop do not autopickup unpaid items in shops death due an unseen gas spore's explosion resulted in "killed by a died" +allow optional parameter "true", "yes", "false", or "no" for boolean options Platform- and/or Interface-Specific Fixes diff --git a/src/options.c b/src/options.c index 37675c3d9..2f74c3564 100644 --- a/src/options.c +++ b/src/options.c @@ -3298,7 +3298,7 @@ boolean tinitial, tfrom_file; * options list */ for (i = 0; boolopt[i].name; i++) { - if (match_optname(opts, boolopt[i].name, 3, FALSE)) { + if (match_optname(opts, boolopt[i].name, 3, TRUE)) { /* options that don't exist */ if (!boolopt[i].addr) { if (!initial && !negated) @@ -3312,6 +3312,23 @@ boolean tinitial, tfrom_file; return; } + op = string_for_opt(opts, TRUE); + + if (op) { + if (negated) { + badoption(opts); + return; + } + if (!strcmp(op, "true") || !strcmp(op, "yes")) + negated = FALSE; + else if (!strcmp(op, "false") || !strcmp(op, "no")) + negated = TRUE; + else { + badoption(opts); + return; + } + } + *(boolopt[i].addr) = !negated; /* 0 means boolean opts */