From: nethack.rankin Date: Tue, 17 May 2005 04:09:32 +0000 (+0000) Subject: autopickup exceptions bit X-Git-Tag: MOVE2GIT~1268 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=761776354d1854e9af8ff8efd2a92fba0ea37974;p=nethack 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. --- 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);