Angband
obj-properties.h
Go to the documentation of this file.
1 
18 #ifndef INCLUDED_OBJPROPERTIES_H
19 #define INCLUDED_OBJPROPERTIES_H
20 
21 #include "z-file.h"
22 #include "z-bitflag.h"
23 
35 enum
36 {
37  #define TV(a, b, c) TV_##a,
38  #include "list-tvals.h"
39  #undef TV
40 
41  TV_MAX
42 };
43 
47 enum {
49  #define OF(a) OF_##a,
50  #include "list-object-flags.h"
51  #undef OF
52 };
53 
57 enum {
58  #define KF(a, b) KF_##a,
59  #include "list-kind-flags.h"
60  #undef KF
61 };
62 
66 enum {
67  #define STAT(a) OBJ_MOD_##a,
68  #include "list-stats.h"
69  #undef STAT
70  #define OBJ_MOD(a) OBJ_MOD_##a,
71  #include "list-object-modifiers.h"
72  #undef OBJ_MOD
74 };
75 
76 /* Where the stats start in modifiers */
77 #define OBJ_MOD_MIN_STAT OBJ_MOD_STR
78 
83  OFT_NONE = 0, /* placeholder flag */
84  OFT_SUST, /* sustains a stat */
85  OFT_PROT, /* protection from an effect */
86  OFT_MISC, /* a good property, suitable for ego items */
87  OFT_LIGHT, /* applicable only to light sources */
88  OFT_MELEE, /* applicable only to melee weapons */
89  OFT_BAD, /* an undesirable flag */
90  OFT_DIG, /* applicable only to diggers */
91 
93 };
94 
99  OFID_NONE = 0, /* never shown */
100  OFID_NORMAL, /* normal ID on use */
101  OFID_TIMED, /* obvious after time */
102  OFID_WIELD /* obvious on wield */
103 };
104 
118 };
119 
120 #define OF_SIZE FLAG_SIZE(OF_MAX)
121 
122 #define of_has(f, flag) flag_has_dbg(f, OF_SIZE, flag, #f, #flag)
123 #define of_next(f, flag) flag_next(f, OF_SIZE, flag)
124 #define of_count(f) flag_count(f, OF_SIZE)
125 #define of_is_empty(f) flag_is_empty(f, OF_SIZE)
126 #define of_is_full(f) flag_is_full(f, OF_SIZE)
127 #define of_is_inter(f1, f2) flag_is_inter(f1, f2, OF_SIZE)
128 #define of_is_subset(f1, f2) flag_is_subset(f1, f2, OF_SIZE)
129 #define of_is_equal(f1, f2) flag_is_equal(f1, f2, OF_SIZE)
130 #define of_on(f, flag) flag_on_dbg(f, OF_SIZE, flag, #f, #flag)
131 #define of_off(f, flag) flag_off(f, OF_SIZE, flag)
132 #define of_wipe(f) flag_wipe(f, OF_SIZE)
133 #define of_setall(f) flag_setall(f, OF_SIZE)
134 #define of_negate(f) flag_negate(f, OF_SIZE)
135 #define of_copy(f1, f2) flag_copy(f1, f2, OF_SIZE)
136 #define of_union(f1, f2) flag_union(f1, f2, OF_SIZE)
137 #define of_inter(f1, f2) flag_inter(f1, f2, OF_SIZE)
138 #define of_diff(f1, f2) flag_diff(f1, f2, OF_SIZE)
139 
140 #define KF_SIZE FLAG_SIZE(KF_MAX)
141 
142 #define kf_has(f, flag) flag_has_dbg(f, KF_SIZE, flag, #f, #flag)
143 #define kf_next(f, flag) flag_next(f, KF_SIZE, flag)
144 #define kf_is_empty(f) flag_is_empty(f, KF_SIZE)
145 #define kf_is_full(f) flag_is_full(f, KF_SIZE)
146 #define kf_is_inter(f1, f2) flag_is_inter(f1, f2, KF_SIZE)
147 #define kf_is_subset(f1, f2) flag_is_subset(f1, f2, KF_SIZE)
148 #define kf_is_equal(f1, f2) flag_is_equal(f1, f2, KF_SIZE)
149 #define kf_on(f, flag) flag_on_dbg(f, KF_SIZE, flag, #f, #flag)
150 #define kf_off(f, flag) flag_off(f, KF_SIZE, flag)
151 #define kf_wipe(f) flag_wipe(f, KF_SIZE)
152 #define kf_setall(f) flag_setall(f, KF_SIZE)
153 #define kf_negate(f) flag_negate(f, KF_SIZE)
154 #define kf_copy(f1, f2) flag_copy(f1, f2, KF_SIZE)
155 #define kf_union(f1, f2) flag_union(f1, f2, KF_SIZE)
156 #define kf_inter(f1, f2) flag_inter(f1, f2, KF_SIZE)
157 #define kf_diff(f1, f2) flag_diff(f1, f2, KF_SIZE)
158 
159 
168 struct obj_property {
170  int type; /* type of property */
171  int subtype; /* subtype of property */
172  int id_type; /* how the property is identified (flags only?) */
173  int index; /* index of the property for its type */
174  int power; /* base power rating */
175  int mult; /* relative weight rating */
176  int type_mult[TV_MAX]; /* relative weight rating specific to object type */
177  char *name; /* property name */
178  char *adjective; /* adjective for property */
179  char *neg_adj; /* adjective for negative of property */
180  char *msg; /* message on noticing property */
181  char *desc; /* extra text for object info */
182 };
183 
184 extern struct obj_property *obj_properties;
185 
190 struct obj_property *lookup_obj_property(int type, int index);
191 void create_obj_flag_mask(bitflag *f, bool id, ...);
192 void flag_message(int flag, char *name);
193 int sustain_flag(int stat);
194 
195 #endif /* !INCLUDED_OBJPROPERTIES_H */
Definition: obj-properties.h:117
int type_mult[TV_MAX]
Definition: obj-properties.h:176
Low-level bit vector manipulation.
Definition: obj-properties.h:102
Definition: obj-properties.h:87
struct obj_property * next
Definition: obj-properties.h:169
char * adjective
Definition: obj-properties.h:178
Definition: obj-properties.h:92
Low-level file (and directory) handling.
Definition: obj-properties.h:109
Definition: obj-properties.h:83
Definition: obj-properties.h:115
int mult
Definition: obj-properties.h:175
Definition: obj-properties.h:90
Structures
Definition: obj-properties.h:168
png_infop png_uint_32 flag
Definition: libpng12/png.h:2191
Definition: obj-properties.h:89
int power
Definition: obj-properties.h:174
Definition: obj-properties.h:116
object kind flags
int index
Definition: obj-properties.h:173
Write value lines for a set of modifiers.
char * desc
Definition: obj-properties.h:181
void create_obj_flag_mask(bitflag *f, bool id,...)
Create a "mask" of object flags of a specific type or ID threshold.
Definition: obj-properties.c:55
Definition: obj-properties.h:84
Definition: obj-properties.h:80
Definition: obj-properties.h:112
Definition: obj-properties.h:88
int sustain_flag(int stat)
Return the sustain flag of a given stat.
Definition: obj-properties.c:132
Definition: obj-properties.h:85
int subtype
Definition: obj-properties.h:171
object_flag_type
The object flag types.
Definition: obj-properties.h:82
byte bitflag
Definition: z-bitflag.h:27
struct obj_property * lookup_obj_property(int type, int index)
Functions
Definition: obj-properties.c:24
Definition: obj-properties.h:48
Definition: obj-properties.h:114
void flag_message(int flag, char *name)
Print a message when an object flag is identified by use.
Definition: obj-properties.c:86
Definition: obj-properties.h:113
object modifiers (plusses and minuses) for all objects
Definition: obj-properties.h:112
obj_property_type
The object property types.
Definition: obj-properties.h:108
Definition: obj-properties.h:86
int type
Definition: obj-properties.h:170
object flags for all objects
int id_type
Definition: obj-properties.h:172
Definition: obj-properties.h:111
Definition: obj-properties.h:101
Intialize random names
Definition: init.c:756
struct obj_property * obj_properties
Definition: obj-properties.c:22
Definition: obj-properties.h:110
object_flag_id
How object flags are IDd.
Definition: obj-properties.h:98
List of object base types.
Definition: obj-properties.h:100
char * name
Definition: obj-properties.h:177
char * neg_adj
Definition: obj-properties.h:179
Definition: obj-properties.h:99
char * msg
Definition: obj-properties.h:180