… | |
… | |
99 | */ |
99 | */ |
100 | struct object *ACC (RW, env); /* Pointer to the object which is the environment. |
100 | struct object *ACC (RW, env); /* Pointer to the object which is the environment. |
101 | * This is typically the container that the object is in. |
101 | * This is typically the container that the object is in. |
102 | */ |
102 | */ |
103 | struct object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
103 | struct object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
104 | struct object *ACC (RW, head); /* Points to the main object of a large body */ |
104 | struct object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
105 | struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */ |
105 | struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */ |
106 | }; |
106 | }; |
107 | |
107 | |
108 | // these are being copied |
108 | // these are being copied |
109 | struct object_copy : attachable<object> |
109 | struct object_copy : attachable<object> |
… | |
… | |
168 | struct object *ACC (RW, current_weapon); /* Pointer to the weapon currently used */ |
168 | struct object *ACC (RW, current_weapon); /* Pointer to the weapon currently used */ |
169 | uint32 ACC (RW, weapontype); /* type of weapon */ |
169 | uint32 ACC (RW, weapontype); /* type of weapon */ |
170 | uint32 ACC (RW, tooltype); /* type of tool or build facility */ |
170 | uint32 ACC (RW, tooltype); /* type of tool or build facility */ |
171 | sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ |
171 | 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 */ |
172 | 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 */ |
173 | /* See the doc/Developers/objects for more info about body locations */ |
175 | |
174 | |
176 | /* Following mostly refers to fields only used for monsters */ |
175 | /* 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 |
176 | 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 */ |
177 | 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 */ |
211 | uint16 ACC (RW, animation_id); /* An index into the animation array */ |
213 | uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ |
212 | uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ |
214 | uint8 ACC (RW, last_anim); /* last sequence used to draw face */ |
213 | uint8 ACC (RW, last_anim); /* last sequence used to draw face */ |
215 | sint32 ACC (RW, elevation); /* elevation of this terrain - not currently used */ |
214 | sint32 ACC (RW, elevation); /* elevation of this terrain - not currently used */ |
216 | uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ |
215 | uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ |
|
|
216 | uint8 ACC (RW, will_apply); /* See crossfire.doc */ |
217 | |
217 | |
218 | MoveType ACC (RW, move_type); /* Type of movement this object uses */ |
218 | MoveType ACC (RW, move_type); /* Type of movement this object uses */ |
219 | MoveType ACC (RW, move_block); /* What movement types this blocks */ |
219 | MoveType ACC (RW, move_block); /* What movement types this blocks */ |
220 | MoveType ACC (RW, move_allow); /* What movement types explicitly allowd */ |
220 | MoveType ACC (RW, move_allow); /* What movement types explicitly allowd */ |
221 | MoveType ACC (RW, move_on); /* Move types affected moving on to this space */ |
221 | MoveType ACC (RW, move_on); /* Move types affected moving on to this space */ |
… | |
… | |
236 | void clear (); |
236 | void clear (); |
237 | void clone (object *destination); |
237 | void clone (object *destination); |
238 | |
238 | |
239 | void set_owner (object *owner); |
239 | void set_owner (object *owner); |
240 | object *get_owner (); |
240 | object *get_owner (); |
|
|
241 | |
|
|
242 | // fully recursive iterator |
|
|
243 | struct iterator_base |
|
|
244 | { |
|
|
245 | object *item; |
|
|
246 | |
|
|
247 | iterator_base (object *container) |
|
|
248 | : item (container) |
|
|
249 | { |
|
|
250 | } |
|
|
251 | |
|
|
252 | operator object *() const { return item; } |
|
|
253 | |
|
|
254 | object *operator ->() const { return item; } |
|
|
255 | object &operator * () const { return *item; } |
|
|
256 | }; |
|
|
257 | |
|
|
258 | // depth-first recursive iterator |
|
|
259 | struct depth_iterator : iterator_base |
|
|
260 | { |
|
|
261 | depth_iterator (object *container); |
|
|
262 | void next (); |
|
|
263 | object *operator ++( ) { next (); return item; } |
|
|
264 | object *operator ++(int) { object *i = item; next (); return i; } |
|
|
265 | }; |
|
|
266 | |
|
|
267 | object *begin () |
|
|
268 | { |
|
|
269 | return this; |
|
|
270 | } |
|
|
271 | |
|
|
272 | object *end () |
|
|
273 | { |
|
|
274 | return this; |
|
|
275 | } |
241 | |
276 | |
242 | protected: |
277 | protected: |
243 | friend struct archetype; |
278 | friend struct archetype; |
244 | |
279 | |
245 | void link (); |
280 | void link (); |