more autopickup_exception

An optimization.

Split the patterns into two chains, one for things you want "always picked up", and one for things you want "never picked up".  That way, the
entire exception list isn't being checked twice, once for each type of
check.  The check for things to "always pick up" only checks the
chain at the AP_GRAB index, and the check for things to "never
pick up" only checks the chain at the AP_LEAVE index.

- Also modifies the toggle autopickup '@' message
appropriately for the AUTOPICKUP_EXCEPTIONS build.
(it just tacks on ", with some exceptions" if there are some)
This commit is contained in:
nethack.allison
2003-11-15 23:15:01 +00:00
parent f1129d502f
commit 94ff3505b4
3 changed files with 84 additions and 79 deletions

View File

@@ -264,8 +264,10 @@ struct instance_flags {
boolean clicklook; /* allow right-clicking for look */
boolean obsolete; /* obsolete options can point at this, it isn't used */
#ifdef AUTOPICKUP_EXCEPTIONS
struct autopickup_exception *autopickup_exceptions;
#endif /* AUTOPICKUP_EXCEPTIONS */
struct autopickup_exception *autopickup_exceptions[2];
#define AP_LEAVE 0
#define AP_GRAB 1
#endif
#ifdef WIN32CON
#define MAX_ALTKEYHANDLER 25
char altkeyhandler[MAX_ALTKEYHANDLER];