From 761776354d1854e9af8ff8efd2a92fba0ea37974 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 17 May 2005 04:09:32 +0000 Subject: [PATCH] autopickup exceptions bit 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 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/options.c b/src/options.c index 7844ad15e..50ce41dbf 100644 --- a/src/options.c +++ b/src/options.c @@ -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); -- 2.40.0