]> granicus.if.org Git - nethack/commitdiff
autopickup exceptions bit
authornethack.rankin <nethack.rankin>
Tue, 17 May 2005 04:09:32 +0000 (04:09 +0000)
committernethack.rankin <nethack.rankin>
Tue, 17 May 2005 04:09:32 +0000 (04:09 +0000)
     My previous change underwent a last minute simplification that changed
behavior.  This puts things back to how I intended:  at the "add new
autopickup exception pattern" prompt, empty input returns you to the upper
add/list/remove/exit menu and ESC returns you past that (back to play or to
other pending 'O' changes, if any).  The previous change accidentally made
empty input behave the same as ESC.

src/options.c

index 7844ad15ef4e10430b0531a6e3c91c9438f70c0c..50ce41dbfe74ec9153555a5ecc87e76568ffb58b 100644 (file)
@@ -3046,16 +3046,20 @@ boolean setinitial,setfromfile;
        } else if (opt_idx == 0) {      /* add new */
                getlin("What new autopickup exception pattern?", &apebuf[1]);
                mungspaces(&apebuf[1]); /* regularize whitespace */
-               if (apebuf[1] && apebuf[1] != '\033') {
-                   apebuf[0] = '\"';
-                   /* guarantee room for \" prefix and \"\0 suffix;
-                      -2 is good enough for apebuf[] but -3 makes
-                      sure the whole thing fits within normal BUFSZ */
-                   apebuf[sizeof apebuf - 3] = '\0';
-                   Strcat(apebuf, "\"");
-                   add_autopickup_exception(apebuf);
+               if (apebuf[1] == '\033') {
+                   ;   /* fall through to function exit */
+               } else {
+                   if (apebuf[1]) {
+                       apebuf[0] = '\"';
+                       /* guarantee room for \" prefix and \"\0 suffix;
+                          -2 is good enough for apebuf[] but -3 makes
+                          sure the whole thing fits within normal BUFSZ */
+                       apebuf[sizeof apebuf - 3] = '\0';
+                       Strcat(apebuf, "\"");
+                       add_autopickup_exception(apebuf);
+                   }
                    goto ape_again;
-               } /* else fall through to function exit */
+               }
        } else {        /* list or remove */
                tmpwin = create_nhwindow(NHW_MENU);
                start_menu(tmpwin);