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.10 2006/08/28 16:52:51 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 : attachable<object> { |
|
|
105 | static data_type get_dt () { 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 clone (object *destination) |
|
|
264 | { |
|
|
265 | if (attach) |
|
|
266 | destination->attach = add_refcount (attach); |
|
|
267 | |
|
|
268 | if (self || cb) |
|
|
269 | INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); |
|
|
270 | } |
259 | }; |
271 | }; |
260 | |
272 | |
261 | typedef struct oblnk { /* Used to link together several objects */ |
273 | typedef struct oblnk { /* Used to link together several objects */ |
262 | object *ob; |
274 | object *ob; |
263 | struct oblnk *next; |
275 | struct oblnk *next; |
… | |
… | |
350 | #define ARCH_SINGULARITY_LEN 11 |
362 | #define ARCH_SINGULARITY_LEN 11 |
351 | #define ARCH_DETECT_MAGIC "detect_magic" |
363 | #define ARCH_DETECT_MAGIC "detect_magic" |
352 | #define ARCH_DEPLETION "depletion" |
364 | #define ARCH_DEPLETION "depletion" |
353 | #define ARCH_SYMPTOM "symptom" |
365 | #define ARCH_SYMPTOM "symptom" |
354 | |
366 | |
355 | extern void (*object_free_callback)(object *ob); // called for every object_free |
|
|
356 | |
|
|
357 | #endif |
367 | #endif |