… | |
… | |
28 | #include <bitset> |
28 | #include <bitset> |
29 | |
29 | |
30 | #include "cfperl.h" |
30 | #include "cfperl.h" |
31 | #include "shstr.h" |
31 | #include "shstr.h" |
32 | |
32 | |
33 | typedef uint32 tag_t; |
33 | typedef int tag_t; |
34 | #define NUM_BODY_LOCATIONS 12 |
34 | #define NUM_BODY_LOCATIONS 12 |
35 | #define BODY_ARMS 1 |
35 | #define BODY_ARMS 1 |
36 | |
36 | |
37 | /* See common/item.c */ |
37 | /* See common/item.c */ |
38 | |
38 | |
… | |
… | |
212 | uint8 ACC (RW, will_apply); /* See crossfire.doc */ |
212 | uint8 ACC (RW, will_apply); /* See crossfire.doc */ |
213 | }; |
213 | }; |
214 | |
214 | |
215 | struct object : zero_initialised, object_copy |
215 | struct object : zero_initialised, object_copy |
216 | { |
216 | { |
217 | typedef unordered_vector<object *> vector; |
|
|
218 | |
|
|
219 | // These variables are not changed by ->copy_to |
217 | // These variables are not changed by ->copy_to |
220 | maptile_ptr ACC (RW, map); /* Pointer to the map in which this object is present */ |
218 | maptile_ptr ACC (RW, map); /* Pointer to the map in which this object is present */ |
221 | |
219 | |
222 | tag_t ACC (RW, count); /* Generation count for this object */ |
|
|
223 | UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. |
220 | UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. |
|
|
221 | int ACC (RO, count); // index into objects |
|
|
222 | int ACC (RO, active); // index into actives |
224 | |
223 | |
225 | player_ptr ACC (RW, contr); /* Pointer to the player which control this object */ |
224 | player_ptr ACC (RW, contr); /* Pointer to the player which control this object */ |
226 | object *ACC (RW, next); /* Pointer to the next object in the free/used list */ |
225 | |
227 | object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ |
|
|
228 | object *ACC (RW, active_next);/* Next & previous object in the 'active' */ |
|
|
229 | object *ACC (RW, active_prev);/* List. This is used in process_events */ |
|
|
230 | /* so that the entire object list does not */ |
|
|
231 | /* need to be gone through. */ |
|
|
232 | object *ACC (RW, below); /* Pointer to the object stacked below this one */ |
226 | object *ACC (RW, below); /* Pointer to the object stacked below this one */ |
233 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
227 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
234 | /* Note: stacked in the *same* environment */ |
228 | /* Note: stacked in the *same* environment */ |
235 | object *inv; /* Pointer to the first object in the inventory */ |
229 | object *inv; /* Pointer to the first object in the inventory */ |
236 | object *ACC (RW, container); /* Current container being used. I think this |
230 | object *ACC (RW, container); /* Current container being used. I think this |
… | |
… | |
338 | |
332 | |
339 | // insert object at same map position as 'where' |
333 | // insert object at same map position as 'where' |
340 | // handles both inventory and map "positions" |
334 | // handles both inventory and map "positions" |
341 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
335 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
342 | |
336 | |
343 | MTH bool active () const; |
|
|
344 | MTH void activate (); |
337 | MTH void activate (); |
345 | MTH void deactivate (); |
338 | MTH void deactivate (); |
346 | MTH void activate_recursive (); |
339 | MTH void activate_recursive (); |
347 | MTH void deactivate_recursive (); |
340 | MTH void deactivate_recursive (); |
348 | |
341 | |
… | |
… | |
402 | void unlink (); |
395 | void unlink (); |
403 | |
396 | |
404 | object (); |
397 | object (); |
405 | ~object (); |
398 | ~object (); |
406 | }; |
399 | }; |
|
|
400 | |
|
|
401 | typedef object_vector<object, &object::count > objectvec; |
|
|
402 | typedef object_vector<object, &object::active> activevec; |
|
|
403 | |
|
|
404 | extern objectvec objects; |
|
|
405 | extern activevec actives; |
|
|
406 | |
|
|
407 | #define for_all_objects(var) \ |
|
|
408 | for (int _i = 0; _i < objects.size (); ++_i) \ |
|
|
409 | declvar (object *, var, objects [_i]) |
|
|
410 | |
|
|
411 | #define for_all_actives(var) \ |
|
|
412 | for (int _i = 0; _i < actives.size (); ++_i) \ |
|
|
413 | declvar (object *, var, actives [_i]) |
407 | |
414 | |
408 | typedef struct oblnk |
415 | typedef struct oblnk |
409 | { /* Used to link together several objects */ |
416 | { /* Used to link together several objects */ |
410 | object_ptr ob; |
417 | object_ptr ob; |
411 | struct oblnk *next; |
418 | struct oblnk *next; |
… | |
… | |
448 | sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is |
455 | sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is |
449 | * in comparison to the head. |
456 | * in comparison to the head. |
450 | */ |
457 | */ |
451 | }; |
458 | }; |
452 | |
459 | |
453 | extern object *objects; |
|
|
454 | extern object *active_objects; |
|
|
455 | |
|
|
456 | extern int nrofallocobjects; |
|
|
457 | |
|
|
458 | /* This returns TRUE if the object is something that |
460 | /* This returns TRUE if the object is something that |
459 | * should be displayed in the look window |
461 | * should be displayed in the floorbox window |
460 | */ |
462 | */ |
461 | #define LOOK_OBJ(ob) (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) |
463 | #define LOOK_OBJ(ob) (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) |
462 | |
464 | |
463 | /* Used by update_object to know if the object being passed is |
465 | /* Used by update_object to know if the object being passed is |
464 | * being added or removed. |
466 | * being added or removed. |