… | |
… | |
56 | { |
56 | { |
57 | key_value *next; |
57 | key_value *next; |
58 | shstr key, value; |
58 | shstr key, value; |
59 | }; |
59 | }; |
60 | |
60 | |
|
|
61 | struct UUID |
|
|
62 | { |
|
|
63 | uint64 seq; |
|
|
64 | }; |
|
|
65 | |
|
|
66 | extern void init_uuid (); |
|
|
67 | extern UUID gen_uuid (); |
61 | |
68 | |
62 | /* Definition for WILL_APPLY values. Replaces having harcoded values |
69 | /* Definition for WILL_APPLY values. Replaces having harcoded values |
63 | * sprinkled in the code. Note that some of these also replace fields |
70 | * sprinkled in the code. Note that some of these also replace fields |
64 | * that were in the can_apply area. What is the point of having both |
71 | * that were in the can_apply area. What is the point of having both |
65 | * can_apply and will_apply? |
72 | * can_apply and will_apply? |
… | |
… | |
68 | #define WILL_APPLY_TREASURE 0x02 |
75 | #define WILL_APPLY_TREASURE 0x02 |
69 | #define WILL_APPLY_EARTHWALL 0x04 |
76 | #define WILL_APPLY_EARTHWALL 0x04 |
70 | #define WILL_APPLY_DOOR 0x08 |
77 | #define WILL_APPLY_DOOR 0x08 |
71 | #define WILL_APPLY_FOOD 0x10 |
78 | #define WILL_APPLY_FOOD 0x10 |
72 | |
79 | |
73 | |
|
|
74 | /* However, if you're keeping a pointer of some sort, you probably |
80 | /* However, if you're keeping a pointer of some sort, you probably |
75 | * don't just want it copied, so you'll need to add to common/object.C, |
81 | * don't just want it copied, so you'll need to add to common/object.C, |
76 | * e.g. copy_object. |
82 | * e.g. copy_object. |
77 | */ |
83 | */ |
78 | |
84 | |
79 | // these are not being copied |
85 | // these are not being copied |
80 | ACC_CLASS (object) |
86 | ACC_CLASS (object) |
81 | struct object_keep : refcounted |
87 | struct object_keep : refcounted |
82 | { |
88 | { |
83 | tag_t ACC (RW, count); /* Unique object number for this object */ |
89 | tag_t ACC (RW, count); /* Unique object number for this object */ |
|
|
90 | UUID uuid; // Unique Identifier, survives saves etc. |
84 | |
91 | |
85 | /* These variables are not changed by copy_object() */ |
92 | /* These variables are not changed by copy_object() */ |
86 | struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ |
93 | struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ |
87 | struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
94 | struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
88 | struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
95 | struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
… | |
… | |
168 | struct object *ACC (RW, current_weapon); /* Pointer to the weapon currently used */ |
175 | struct object *ACC (RW, current_weapon); /* Pointer to the weapon currently used */ |
169 | uint32 ACC (RW, weapontype); /* type of weapon */ |
176 | uint32 ACC (RW, weapontype); /* type of weapon */ |
170 | uint32 ACC (RW, tooltype); /* type of tool or build facility */ |
177 | uint32 ACC (RW, tooltype); /* type of tool or build facility */ |
171 | sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ |
178 | sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ |
172 | sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ |
179 | sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ |
173 | uint8 ACC (RW, will_apply); /* See crossfire.doc */ |
|
|
174 | /* See the doc/Developers/objects for more info about body locations */ |
180 | /* See the doc/Developers/objects for more info about body locations */ |
175 | |
181 | |
176 | /* Following mostly refers to fields only used for monsters */ |
182 | /* Following mostly refers to fields only used for monsters */ |
177 | tag_t ACC (RW, ownercount); /* What count the owner had (in case owner has been freed) *///TODO: remove/fix |
183 | tag_t ACC (RW, ownercount); /* What count the owner had (in case owner has been freed) *///TODO: remove/fix |
178 | struct object *ACC (RW, enemy); /* Monster/player to follow even if not closest */ |
184 | struct object *ACC (RW, enemy); /* Monster/player to follow even if not closest */ |
… | |
… | |
212 | uint16 ACC (RW, animation_id); /* An index into the animation array */ |
218 | uint16 ACC (RW, animation_id); /* An index into the animation array */ |
213 | uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ |
219 | uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ |
214 | uint8 ACC (RW, last_anim); /* last sequence used to draw face */ |
220 | uint8 ACC (RW, last_anim); /* last sequence used to draw face */ |
215 | sint32 ACC (RW, elevation); /* elevation of this terrain - not currently used */ |
221 | sint32 ACC (RW, elevation); /* elevation of this terrain - not currently used */ |
216 | uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ |
222 | uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ |
|
|
223 | uint8 ACC (RW, will_apply); /* See crossfire.doc */ |
217 | |
224 | |
218 | MoveType ACC (RW, move_type); /* Type of movement this object uses */ |
225 | MoveType ACC (RW, move_type); /* Type of movement this object uses */ |
219 | MoveType ACC (RW, move_block); /* What movement types this blocks */ |
226 | MoveType ACC (RW, move_block); /* What movement types this blocks */ |
220 | MoveType ACC (RW, move_allow); /* What movement types explicitly allowd */ |
227 | MoveType ACC (RW, move_allow); /* What movement types explicitly allowd */ |
221 | MoveType ACC (RW, move_on); /* Move types affected moving on to this space */ |
228 | MoveType ACC (RW, move_on); /* Move types affected moving on to this space */ |
… | |
… | |
234 | static bool can_merge (object *op1, object *op2); |
241 | static bool can_merge (object *op1, object *op2); |
235 | |
242 | |
236 | void clear (); |
243 | void clear (); |
237 | void clone (object *destination); |
244 | void clone (object *destination); |
238 | |
245 | |
|
|
246 | void instantiate () |
|
|
247 | { |
|
|
248 | if (!uuid.seq) // HACK |
|
|
249 | uuid = gen_uuid (); |
|
|
250 | |
|
|
251 | attachable<object>::instantiate (); |
|
|
252 | } |
|
|
253 | |
239 | void set_owner (object *owner); |
254 | void set_owner (object *owner); |
240 | object *get_owner (); |
255 | object *get_owner (); |
|
|
256 | |
|
|
257 | // info must hold 256 * 3 bytes currently |
|
|
258 | const char *debug_desc (char *info) const; |
|
|
259 | const char *debug_desc () const; |
241 | |
260 | |
242 | // fully recursive iterator |
261 | // fully recursive iterator |
243 | struct iterator_base |
262 | struct iterator_base |
244 | { |
263 | { |
245 | object *item; |
264 | object *item; |