1 | /* |
1 | /* |
2 | * static char *rcsid_object_h = |
2 | * static char *rcsid_object_h = |
3 | * "$Id: object.h,v 1.5 2006/08/25 17:11:53 root Exp $"; |
3 | * "$Id: object.h,v 1.7 2006/08/26 23:36:32 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
26 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
26 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
27 | */ |
27 | */ |
28 | |
28 | |
29 | #ifndef OBJECT_H |
29 | #ifndef OBJECT_H |
30 | #define OBJECT_H |
30 | #define OBJECT_H |
|
|
31 | |
|
|
32 | #include "cfperl.h" |
|
|
33 | #include "shstr.h" |
31 | |
34 | |
32 | typedef uint32 tag_t; |
35 | typedef uint32 tag_t; |
33 | #define NUM_BODY_LOCATIONS 12 |
36 | #define NUM_BODY_LOCATIONS 12 |
34 | #define BODY_ARMS 1 |
37 | #define BODY_ARMS 1 |
35 | |
38 | |
… | |
… | |
96 | * related ones, etc. |
99 | * related ones, etc. |
97 | * This structure is best viewed with about a 100 width screen. |
100 | * This structure is best viewed with about a 100 width screen. |
98 | * MSW 2002-07-05 |
101 | * MSW 2002-07-05 |
99 | */ |
102 | */ |
100 | |
103 | |
101 | struct object_simple { |
104 | struct object_simple : extendable<object> { |
|
|
105 | data_type get_dt () const { return DT_OBJECT; } |
|
|
106 | |
102 | /* These variables are not changed by copy_object() */ |
107 | /* These variables are not changed by copy_object() */ |
103 | struct pl *contr; /* Pointer to the player which control this object */ |
108 | struct pl *contr; /* Pointer to the player which control this object */ |
104 | struct object *next; /* Pointer to the next object in the free/used list */ |
109 | struct object *next; /* Pointer to the next object in the free/used list */ |
105 | struct object *prev; /* Pointer to the previous object in the free/used list*/ |
110 | struct object *prev; /* Pointer to the previous object in the free/used list*/ |
106 | struct object *active_next; /* Next & previous object in the 'active' */ |
111 | struct object *active_next; /* Next & previous object in the 'active' */ |
… | |
… | |
253 | const char *custom_name; /* Custom name assigned by player */ |
258 | const char *custom_name; /* Custom name assigned by player */ |
254 | key_value *key_values; /* Fields not explictly known by the loader. */ |
259 | key_value *key_values; /* Fields not explictly known by the loader. */ |
255 | }; |
260 | }; |
256 | |
261 | |
257 | struct object : object_special, object_simple { |
262 | struct object : object_special, object_simple { |
258 | void *self, *cb; // CF+ perl's self and callback registry |
263 | void instantiate_ (); |
|
|
264 | void instantiate () |
|
|
265 | { |
|
|
266 | if (attach) |
|
|
267 | { |
|
|
268 | instantiate_ (); |
|
|
269 | free_string (attach); |
|
|
270 | attach = 0; |
|
|
271 | } |
|
|
272 | } |
|
|
273 | void clone (object *destination) |
|
|
274 | { |
|
|
275 | if (attach) |
|
|
276 | destination->attach = add_refcount (attach); |
|
|
277 | |
|
|
278 | if (self || cb) |
|
|
279 | INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); |
|
|
280 | } |
259 | }; |
281 | }; |
260 | |
282 | |
261 | typedef struct oblnk { /* Used to link together several objects */ |
283 | typedef struct oblnk { /* Used to link together several objects */ |
262 | object *ob; |
284 | object *ob; |
263 | struct oblnk *next; |
285 | struct oblnk *next; |
… | |
… | |
350 | #define ARCH_SINGULARITY_LEN 11 |
372 | #define ARCH_SINGULARITY_LEN 11 |
351 | #define ARCH_DETECT_MAGIC "detect_magic" |
373 | #define ARCH_DETECT_MAGIC "detect_magic" |
352 | #define ARCH_DEPLETION "depletion" |
374 | #define ARCH_DEPLETION "depletion" |
353 | #define ARCH_SYMPTOM "symptom" |
375 | #define ARCH_SYMPTOM "symptom" |
354 | |
376 | |
355 | extern void (*object_free_callback)(object *ob); // called for every object_free |
|
|
356 | |
|
|
357 | #endif |
377 | #endif |