autopickup_exceptions build option

Add config.h experimental option AUTOPICKUP_EXCEPTIONS.

It's an interface-only change which allows you to add lines to your
config file to selectively avoid autopickup of items based on their
text description that is displayed when you pick them up. It does
it by matching a pattern against the xname singular return value.

For example:

autopickup_exception = "*corpse" will avoid picking up corpses, even if
food (%) is in your pickup_types.

autopickup_exception = "*brown*"
will avoid picking up any brown items (why, I do not know)

autopickup_exception = "*loadstone"
will NOT avoid picking up loadstones, unless they are already
identified, because the xname string will be "gray stone", so no
match there.

The matching has no knowledge of in-game objects, it is just
a text pattern match, thus it is an interface change, not a gameplay
change, and it is meant as a convenience for players.
This commit is contained in:
nethack.allison
2003-11-15 01:05:32 +00:00
parent 507e1293e6
commit c0349ec918
9 changed files with 253 additions and 4 deletions

View File

@@ -352,6 +352,7 @@ typedef unsigned char uchar;
*/
/*#define GOLDOBJ */ /* Gold is kept on obj chains - Helge Hafting */
#define AUTOPICKUP_EXCEPTIONS /* exceptions to autopickup - M. Allison */
/* End of Section 5 */

View File

@@ -369,6 +369,13 @@ E char *fqn_prefix[PREFIX_COUNT];
E char *fqn_prefix_names[PREFIX_COUNT];
#endif
#ifdef AUTOPICKUP_EXCEPTIONS
struct autopickup_exception {
char *pattern;
struct autopickup_exception *next;
};
#endif /* AUTOPICKUP_EXCEPTIONS */
#undef E
#endif /* DECL_H */

View File

@@ -1416,6 +1416,10 @@ E void FDECL(set_duplicate_opt_detection, (int));
E void FDECL(set_wc_option_mod_status, (unsigned long, int));
E void FDECL(set_wc2_option_mod_status, (unsigned long, int));
E void FDECL(set_option_mod_status, (const char *,int));
#ifdef AUTOPICKUP_EXCEPTIONS
E int FDECL(add_autopickup_exception_mapping, (const char *));
E void NDECL(free_autopickup_exception_mappings);
#endif /* AUTOPICKUP_EXCEPTIONS */
/* ### pager.c ### */

View File

@@ -263,6 +263,9 @@ struct instance_flags {
boolean cmdassist; /* provide detailed assistance for some commands */
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 */
#ifdef WIN32CON
#define MAX_ALTKEYHANDLER 25
char altkeyhandler[MAX_ALTKEYHANDLER];