]> granicus.if.org Git - nethack/commitdiff
interactive !pickup_types
authorPatR <rankin@nethack.org>
Thu, 13 Dec 2018 02:49:12 +0000 (18:49 -0800)
committerPatR <rankin@nethack.org>
Thu, 13 Dec 2018 02:49:12 +0000 (18:49 -0800)
To use 'O' to clear a value from pickup_types with menustyle Traditional
or Combination, you needed to give a value starting with 'a' (for 'all').
Accept space(s) too, similar to removing an object or monster name.

src/options.c

index 3a190b9c179d7daa32a8c809884271b2cbe15046..d0358caf0323f4122b4ea66037ace107c1180775 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 options.c       $NHDT-Date: 1544396581 2018/12/09 23:03:01 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.340 $ */
+/* NetHack 3.6 options.c       $NHDT-Date: 1544669347 2018/12/13 02:49:07 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.343 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Michael Allison, 2008. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2986,12 +2986,17 @@ boolean tinitial, tfrom_file;
             use_menu = TRUE;
             if (flags.menu_style == MENU_TRADITIONAL
                 || flags.menu_style == MENU_COMBINATION) {
+                boolean wasspace;
+
                 use_menu = FALSE;
                 Sprintf(qbuf, "New %s: [%s am] (%s)", fullname, ocl,
                         *tbuf ? tbuf : "all");
                 getlin(qbuf, abuf);
+                wasspace = (abuf[0] == ' '); /* before mungspaces */
                 op = mungspaces(abuf);
-                if (abuf[0] == '\0' || abuf[0] == '\033')
+                if (wasspace && !abuf[0])
+                    ; /* one or more spaces will remove old value */
+                else if (!abuf[0] || abuf[0] == '\033')
                     op = tbuf; /* restore */
                 else if (abuf[0] == 'm')
                     use_menu = TRUE;