]> granicus.if.org Git - nethack/commitdiff
B02005 and B02006
authornethack.allison <nethack.allison>
Tue, 2 Dec 2003 05:00:02 +0000 (05:00 +0000)
committernethack.allison <nethack.allison>
Tue, 2 Dec 2003 05:00:02 +0000 (05:00 +0000)
B02006 autopickup_exception documentation

>Should the documentation say what priority order is used if two conflict?
>(For example, how ">*orcish" and "<*arrow" handle an orcish arrow; from
>experimentation, > always takes precedent over < , but I could be
>missing something.)

B02005 autopickup_exception option menu

> It'd be nice if you were returned to the menu after adding an exception
> via O so that you can set several with one command.

doc/Guidebook.mn
doc/Guidebook.tex
src/options.c

index a3b1be17176a8a3078f87e023da6530bb230480f..fcef1dc4f6e075d8c05c4bbc203608e710f7484e 100644 (file)
@@ -2362,6 +2362,7 @@ autopickup_exception=">* cursed*"
 The first example above will result in autopickup of any type of arrow.
 The second example results in the exclusion of any corpse from autopickup.
 The last example results in the exclusion of items known to be cursed from autopickup.
+A `never pickup' rule takes precedence over an `always pickup' rule if both match.
 .hn 2
 Configuring User Sounds
 .pg
index e38571953c5276de1aadb1a1a1845c0f34ec5fe2..54d1117be7ae1768e104d6eee2539ce026ae114c 100644 (file)
@@ -27,7 +27,7 @@
 \begin{document}
 %
 % input file: guidebook.mn
-% $Revision: 1.79 $ $Date: 2003/11/26 08:37:08 $
+% $Revision: 1.80 $ $Date: 2003/12/02 03:29:38 $
 %
 %.ds h0 "
 %.ds h1 %.ds h2 \%
@@ -2903,6 +2903,7 @@ Here's a couple of examples of autopickup\_exceptions:
 The first example above will result in autopickup of any type of arrow.
 The second example results in the exclusion of any corpse from autopickup.
 The last example results in the exclusion of items known to be cursed from autopickup.
+A `never pickup' rule takes precedence over an `always pickup' rule if both match.
 
 %.lp
 %.hn 2
index 8214fcd1ba32e051ad9837a173421e9bd60f86e5..b1c8b7f32611267d3715832c355526a0f995d1f4 100644 (file)
@@ -2848,7 +2848,7 @@ boolean setinitial,setfromfile;
 #ifdef AUTOPICKUP_EXCEPTIONS
     } else if (!strcmp("autopickup_exception", optname)) {
        boolean retval;
-       int pick_cnt, pick_idx, opt_idx = 0, pass;
+       int pick_cnt, pick_idx, opt_idx, pass;
        int totalapes = 0, numapes[2] = {0,0};
        menu_item *pick_list = (menu_item *)0;
        anything any;
@@ -2857,31 +2857,31 @@ boolean setinitial,setfromfile;
        static const char *action_titles[] = {
                "a", "add new autopickup exception",
                "l", "list autopickup exceptions",
-               "r", "remove existing autopickup exception"
+               "r", "remove existing autopickup exception",
+               "e", "exit this menu",
        };
-       totalapes = count_ape_maps(&numapes[AP_LEAVE], &numapes[AP_GRAB]);
 ape_again:
-       if (totalapes > 0) {
-               tmpwin = create_nhwindow(NHW_MENU);
-               start_menu(tmpwin);
-               any.a_int = 0;
-               for (i = 0; i < (totalapes ? SIZE(action_titles) :
-                                SIZE(action_titles) - 4); i += 2) {
-                       any.a_int++;
-                       add_menu(tmpwin, NO_GLYPH, &any, *action_titles[i],
-                             0, ATR_NONE, action_titles[i+1], MENU_UNSELECTED);
-               }
-               end_menu(tmpwin, "Do what with autopickup exception list?");
-               if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) {
-                       for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
-                               opt_idx = pick_list[pick_idx].item.a_int - 1;
-                       }
-                       free((genericptr_t)pick_list);
-                       pick_list = (menu_item *)0;
+       opt_idx = 0;
+       totalapes = count_ape_maps(&numapes[AP_LEAVE], &numapes[AP_GRAB]);
+       tmpwin = create_nhwindow(NHW_MENU);
+       start_menu(tmpwin);
+       any.a_int = 0;
+       for (i = 0; i < SIZE(action_titles) ; i += 2) {
+               any.a_int++;
+               if (!totalapes && (i >= 2 && i < 6)) continue;
+               add_menu(tmpwin, NO_GLYPH, &any, *action_titles[i],
+                     0, ATR_NONE, action_titles[i+1], MENU_UNSELECTED);
+        }
+       end_menu(tmpwin, "Do what?");
+       if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &pick_list)) > 0) {
+               for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
+                       opt_idx = pick_list[pick_idx].item.a_int - 1;
                }
-               destroy_nhwindow(tmpwin);
-               if (pick_cnt < 1) return FALSE;
-       } /* else just ask for new pickup exception string */
+               free((genericptr_t)pick_list);
+               pick_list = (menu_item *)0;
+       }
+       destroy_nhwindow(tmpwin);
+       if (pick_cnt < 1) return FALSE;
 
        if (opt_idx == 0) {     /* add new */
                getlin("What new autopickup exception pattern?", &apebuf[1]);
@@ -2889,6 +2889,9 @@ ape_again:
                apebuf[0] = '"';
                Strcat(apebuf,"\"");
                add_autopickup_exception(apebuf);
+               goto ape_again;
+       } else if (opt_idx == 3) {
+               retval = TRUE;
        } else {        /* remove */
                tmpwin = create_nhwindow(NHW_MENU);
                start_menu(tmpwin);
@@ -2921,7 +2924,7 @@ ape_again:
                free((genericptr_t)pick_list);
                pick_list = (menu_item *)0;
                destroy_nhwindow(tmpwin);
-               if (opt_idx == 1) goto ape_again;
+               goto ape_again;
        }
        retval = TRUE;
 #endif /* AUTOPICKUP_EXCEPTIONS */