1 /** 2 * \file obj-ignore.h 3 * \brief Item ignoring 4 * 5 * Copyright (c) 2007 David T. Blackston, Iain McFall, DarkGod, Jeff Greene, 6 * David Vestal, Pete Mack, Andi Sidwell. 7 * 8 * This work is free software; you can redistribute it and/or modify it 9 * under the terms of either: 10 * 11 * a) the GNU General Public License as published by the Free Software 12 * Foundation, version 2, or 13 * 14 * b) the "Angband licence": 15 * This software may be copied and distributed for educational, research, 16 * and not for profit purposes provided that this copyright and statement 17 * are included in all such copies. Other copyrights may also apply. 18 */ 19 #ifndef OBJ_IGNORE_H 20 #define OBJ_IGNORE_H 21 22 /* 23 * Used for mapping the values below to names. 24 */ 25 typedef struct 26 { 27 unsigned int enum_val; 28 const char *name; 29 } quality_name_struct; 30 31 /* 32 * List of kinds of item, for pseudo-id and ego ignore. 33 */ 34 typedef enum 35 { 36 #define ITYPE(a, b) ITYPE_##a, 37 #include "list-ignore-types.h" 38 #undef ITYPE 39 40 ITYPE_MAX 41 } ignore_type_t; 42 43 44 #define ITYPE_SIZE FLAG_SIZE(ITYPE_MAX) 45 46 #define itype_has(f, flag) flag_has_dbg(f, ITYPE_SIZE, flag, #f, #flag) 47 #define itype_on(f, flag) flag_on_dbg(f, ITYPE_SIZE, flag, #f, #flag) 48 #define itype_wipe(f) flag_wipe(f, ITYPE_SIZE) 49 50 /* 51 * The different kinds of quality ignore 52 */ 53 enum 54 { 55 IGNORE_NONE, 56 IGNORE_BAD, 57 IGNORE_AVERAGE, 58 IGNORE_GOOD, 59 IGNORE_ALL, 60 61 IGNORE_MAX 62 }; 63 64 65 /** 66 * Structure to describe ego item short name. 67 */ 68 struct ego_desc { 69 s16b e_idx; 70 u16b itype; 71 const char *short_name; 72 }; 73 74 /* 75 * Ignore flags 76 */ 77 #define IGNORE_IF_AWARE 0x01 78 #define IGNORE_IF_UNAWARE 0x02 79 80 81 82 extern quality_name_struct quality_values[IGNORE_MAX]; 83 extern quality_name_struct quality_choices[ITYPE_MAX]; 84 extern bool **ego_ignore_types; 85 86 87 /* obj-ignore.c */ 88 void ignore_birth_init(void); 89 void rune_autoinscribe(int i); 90 const char *get_autoinscription(struct object_kind *kind, bool aware); 91 int apply_autoinscription(struct object *obj); 92 int remove_autoinscription(s16b kind); 93 int add_autoinscription(s16b kind, const char *inscription, bool aware); 94 void autoinscribe_ground(void); 95 void autoinscribe_pack(void); 96 void object_ignore_flavor_of(const struct object *obj); 97 ignore_type_t ignore_type_of(const struct object *obj); 98 byte ignore_level_of(const struct object *obj); 99 bool ego_has_ignore_type(struct ego_item *ego, ignore_type_t itype); 100 void kind_ignore_clear(struct object_kind *kind); 101 void ego_ignore(struct object *obj); 102 void ego_ignore_clear(struct object *obj); 103 void ego_ignore_toggle(int e_idx, int itype); 104 bool ego_is_ignored(int e_idx, int itype); 105 bool kind_is_ignored_aware(const struct object_kind *kind); 106 bool kind_is_ignored_unaware(const struct object_kind *kind); 107 void kind_ignore_when_aware(struct object_kind *kind); 108 void kind_ignore_when_unaware(struct object_kind *kind); 109 bool object_is_ignored(const struct object *obj); 110 bool ignore_item_ok(const struct object *obj); 111 bool ignore_known_item_ok(const struct object *obj); 112 void ignore_drop(void); 113 const char *ignore_name_for_type(ignore_type_t type); 114 115 extern byte ignore_level[]; 116 extern const size_t ignore_size; 117 118 /* ui-options.c */ 119 int ego_item_name(char *buf, size_t buf_size, struct ego_desc *desc); 120 121 #endif /* !OBJ_IGNORE_H */ 122