From: nhmall Date: Thu, 20 Feb 2020 21:56:05 +0000 (-0500) Subject: preserve menu sort between 'O' commands in same instance X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e6e4922f8ea73fee1020b27723d54827a0ce6b7;p=nethack preserve menu sort between 'O' commands in same instance Also, only execute the change settings loop when the menu response was > 0 --- diff --git a/src/botl.c b/src/botl.c index 8a2fe8e43..5aedb928d 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1031,13 +1031,14 @@ char *opts; void cond_menu(VOID_ARGS) { - int i, res, idx = 0, sortorder = 0; + static int sortorder = 0; + static const char *menutitle[2] = { "alphabetically", "by ranking"}; + int i, res, idx = 0; int sequence[CONDITION_COUNT]; winid tmpwin; anything any; menu_item *picks = (menu_item *) 0; char mbuf[QBUFSZ]; - static const char *menutitle[2] = { "alphabetically", "by ranking"}; boolean showmenu = TRUE; do { @@ -1095,9 +1096,11 @@ cond_menu(VOID_ARGS) } } while (showmenu); - for (i = 0; i < CONDITION_COUNT; ++i) { - if (condtests[i].enabled != condtests[i].choice) - condtests[i].enabled = condtests[i].choice; + if (res > 0) { + for (i = 0; i < CONDITION_COUNT; ++i) { + if (condtests[i].enabled != condtests[i].choice) + condtests[i].enabled = condtests[i].choice; + } } }