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 
24 /*** Constants ***/
25 
26 /* The object flags */
27 enum {
29  #define STAT(a, b, c, d, e, f, g, h) OF_##c,
30  #include "list-stats.h"
31  #undef STAT
32  #define OF(a, b, c, d, e) OF_##a,
33  #include "list-object-flags.h"
34  #undef OF
35 };
36 
37 /* The object kind flags */
38 enum {
39  #define KF(a, b) KF_##a,
40  #include "list-kind-flags.h"
41  #undef KF
42 };
43 
44 /* The object modifiers */
45 enum {
46  #define STAT(a, b, c, d, e, f, g, h) OBJ_MOD_##a,
47  #include "list-stats.h"
48  #undef STAT
49  #define OBJ_MOD(a, b, c, d) OBJ_MOD_##a,
51  #undef OBJ_MOD
53 };
54 
55 /* The object flag types */
57  OFT_NONE = 0, /* placeholder flag */
58  OFT_SUST, /* sustains a stat */
59  OFT_PROT, /* protection from an effect */
60  OFT_MISC, /* a good property, suitable for ego items */
61  OFT_LIGHT, /* applicable only to light sources */
62  OFT_MELEE, /* applicable only to melee weapons */
63  OFT_CURSE, /* a "sticky" curse */
64  OFT_BAD, /* an undesirable flag that isn't a curse */
65 
67 };
68 
69 /* How object flags are IDd */
71  OFID_NONE = 0, /* never shown */
72  OFID_NORMAL, /* normal ID on use */
73  OFID_TIMED, /* obvious after time */
74  OFID_WIELD /* obvious on wield */
75 };
76 
77 #define OF_SIZE FLAG_SIZE(OF_MAX)
78 
79 #define of_has(f, flag) flag_has_dbg(f, OF_SIZE, flag, #f, #flag)
80 #define of_next(f, flag) flag_next(f, OF_SIZE, flag)
81 #define of_is_empty(f) flag_is_empty(f, OF_SIZE)
82 #define of_is_full(f) flag_is_full(f, OF_SIZE)
83 #define of_is_inter(f1, f2) flag_is_inter(f1, f2, OF_SIZE)
84 #define of_is_subset(f1, f2) flag_is_subset(f1, f2, OF_SIZE)
85 #define of_is_equal(f1, f2) flag_is_equal(f1, f2, OF_SIZE)
86 #define of_on(f, flag) flag_on_dbg(f, OF_SIZE, flag, #f, #flag)
87 #define of_off(f, flag) flag_off(f, OF_SIZE, flag)
88 #define of_wipe(f) flag_wipe(f, OF_SIZE)
89 #define of_setall(f) flag_setall(f, OF_SIZE)
90 #define of_negate(f) flag_negate(f, OF_SIZE)
91 #define of_copy(f1, f2) flag_copy(f1, f2, OF_SIZE)
92 #define of_union(f1, f2) flag_union(f1, f2, OF_SIZE)
93 #define of_comp_union(f1, f2) flag_comp_union(f1, f2, OF_SIZE)
94 #define of_inter(f1, f2) flag_inter(f1, f2, OF_SIZE)
95 #define of_diff(f1, f2) flag_diff(f1, f2, OF_SIZE)
96 
97 #define KF_SIZE FLAG_SIZE(KF_MAX)
98 
99 #define kf_has(f, flag) flag_has_dbg(f, KF_SIZE, flag, #f, #flag)
100 #define kf_next(f, flag) flag_next(f, KF_SIZE, flag)
101 #define kf_is_empty(f) flag_is_empty(f, KF_SIZE)
102 #define kf_is_full(f) flag_is_full(f, KF_SIZE)
103 #define kf_is_inter(f1, f2) flag_is_inter(f1, f2, KF_SIZE)
104 #define kf_is_subset(f1, f2) flag_is_subset(f1, f2, KF_SIZE)
105 #define kf_is_equal(f1, f2) flag_is_equal(f1, f2, KF_SIZE)
106 #define kf_on(f, flag) flag_on_dbg(f, KF_SIZE, flag, #f, #flag)
107 #define kf_off(f, flag) flag_off(f, KF_SIZE, flag)
108 #define kf_wipe(f) flag_wipe(f, KF_SIZE)
109 #define kf_setall(f) flag_setall(f, KF_SIZE)
110 #define kf_negate(f) flag_negate(f, KF_SIZE)
111 #define kf_copy(f1, f2) flag_copy(f1, f2, KF_SIZE)
112 #define kf_union(f1, f2) flag_union(f1, f2, KF_SIZE)
113 #define kf_comp_union(f1, f2) flag_comp_union(f1, f2, KF_SIZE)
114 #define kf_inter(f1, f2) flag_inter(f1, f2, KF_SIZE)
115 #define kf_diff(f1, f2) flag_diff(f1, f2, KF_SIZE)
116 
117 
118 /*** Structures ***/
119 
123 struct object_flag {
124  u16b index; /* the OF_ index */
125  u16b id; /* how is it identified */
126  u16b type; /* OFT_ category */
127  s16b power; /* base power rating */
128  const char *message; /* id message */
129 };
130 
134 struct object_mod {
135  u16b index; /* the OBJ_MOD_ index */
136  s16b power; /* base power rating */
137  s16b mod_mult; /* modifier weight rating */
138  const char *name; /* id message */
139 };
140 
141 
142 /*** Functions ***/
143 bool cursed_p(const bitflag *f);
144 void create_mask(bitflag *f, bool id, ...);
145 s32b flag_power(int flag);
147 const char *flag_name(int flag);
148 s16b flag_slot_mult(int flag, int slot);
149 int obj_flag_type(int flag);
150 void flag_message(int flag, char *name);
151 int sustain_flag(int stat);
152 const char *mod_name(int mod);
153 s32b mod_power(int mod);
154 int mod_mult(int mod);
155 s16b mod_slot_mult(int mod, int slot);
156 
157 #endif /* !INCLUDED_OBJPROPERTIES_H */