]> granicus.if.org Git - nethack/commitdiff
fix github issue #238 - 'scores' option v3.6.3.757eca7
authorPatR <rankin@nethack.org>
Sat, 26 Oct 2019 06:11:06 +0000 (23:11 -0700)
committerPatR <rankin@nethack.org>
Sat, 26 Oct 2019 06:11:06 +0000 (23:11 -0700)
Fixes #238

For the three fields in the 'scores' option's argument: top, around,
and own, if any was separated from preceding one by space(s) rather
than slash and lacked a count prefix, the argument parsing skipped
over it.  So "10t/3a/o" and "10t 3a 1o" worked but "10t 3a o" ignored
the 'o'.  The issue report was about 'own' but there's nothing special
about 'own' itself; just that it doesn't warrant a count prefix and is
usually last (in other words, normally preceded by one or both of the
other two) so more likely to trip over this.

[I thought there was another report about 'scores' misbehaving (from
quite a while ago) but couldn't find one.  If it exists, it might have
been about the same thing.]

doc/fixes36.3
src/options.c

index c8461fcc6939bd4d05c22b97545dca37df135abf..c767a776fbd7210e74b5a3301835774a34a1b59c 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.145 $ $NHDT-Date: 1571531885 2019/10/20 00:38:05 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.147 $ $NHDT-Date: 1572070254 2019/10/26 06:10:54 $
 
 This fixes36.3 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -204,6 +204,9 @@ grammar correction for "That walking shoes is really a small mimic" when
        applying a stethoscope
 mimic immitating a slime mold would change fruit type when player assigned new
        named fruit
+parsing for the argument to 'scores' option was sloppy; "3a/o" (slash) and
+       "3a 1o" (space and digit one, not lowercase L) both worked but "3a o"
+       (just space) was supposed to but didn't
 
 
 Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
index f4975688a0a8428932e7095d4cb0d154086c1d38..64ab1a9ba6bc830b2f97a51161d725c761451702 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 options.c       $NHDT-Date: 1571448220 2019/10/19 01:23:40 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.380 $ */
+/* NetHack 3.6 options.c       $NHDT-Date: 1572070255 2019/10/26 06:10:55 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.381 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Michael Allison, 2008. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -3262,8 +3262,12 @@ boolean tinitial, tfrom_file;
                 config_error_add("Unknown %s parameter '%s'", fullname, op);
                 return FALSE;
             }
-            while (letter(*++op) || *op == ' ')
-                continue;
+            /* "3a" is sufficient but accept "3around" (or "3abracadabra") */
+            while (letter(*op))
+                op++;
+            /* t, a, and o can be separated by space(s) or slash or both */
+            while (*op == ' ')
+                op++;
             if (*op == '/')
                 op++;
         }