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.6 2006/08/26 08:44:06 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" |
31 | |
33 | |
32 | typedef uint32 tag_t; |
34 | typedef uint32 tag_t; |
33 | #define NUM_BODY_LOCATIONS 12 |
35 | #define NUM_BODY_LOCATIONS 12 |
34 | #define BODY_ARMS 1 |
36 | #define BODY_ARMS 1 |
35 | |
37 | |
… | |
… | |
123 | |
125 | |
124 | tag_t count; /* Unique object number for this object */ |
126 | tag_t count; /* Unique object number for this object */ |
125 | uint16 refcount; /* How many objects points to this object */ |
127 | uint16 refcount; /* How many objects points to this object */ |
126 | }; |
128 | }; |
127 | |
129 | |
128 | struct object_special { |
130 | struct object_special : extendable<object> { |
|
|
131 | data_type get_dt () const { return DT_OBJECT; } |
|
|
132 | |
129 | /* These get an extra add_refcount(), after having been copied by memcpy(). |
133 | /* These get an extra add_refcount(), after having been copied by memcpy(). |
130 | * All fields beow this point are automatically copied by memcpy. If |
134 | * All fields beow this point are automatically copied by memcpy. If |
131 | * adding something that needs a refcount updated, make sure you modify |
135 | * adding something that needs a refcount updated, make sure you modify |
132 | * copy_object to do so. Everything below here also gets cleared |
136 | * copy_object to do so. Everything below here also gets cleared |
133 | * by clear_object() |
137 | * by clear_object() |
… | |
… | |
253 | const char *custom_name; /* Custom name assigned by player */ |
257 | const char *custom_name; /* Custom name assigned by player */ |
254 | key_value *key_values; /* Fields not explictly known by the loader. */ |
258 | key_value *key_values; /* Fields not explictly known by the loader. */ |
255 | }; |
259 | }; |
256 | |
260 | |
257 | struct object : object_special, object_simple { |
261 | struct object : object_special, object_simple { |
258 | void *self, *cb; // CF+ perl's self and callback registry |
|
|
259 | }; |
262 | }; |
260 | |
263 | |
261 | typedef struct oblnk { /* Used to link together several objects */ |
264 | typedef struct oblnk { /* Used to link together several objects */ |
262 | object *ob; |
265 | object *ob; |
263 | struct oblnk *next; |
266 | struct oblnk *next; |
… | |
… | |
350 | #define ARCH_SINGULARITY_LEN 11 |
353 | #define ARCH_SINGULARITY_LEN 11 |
351 | #define ARCH_DETECT_MAGIC "detect_magic" |
354 | #define ARCH_DETECT_MAGIC "detect_magic" |
352 | #define ARCH_DEPLETION "depletion" |
355 | #define ARCH_DEPLETION "depletion" |
353 | #define ARCH_SYMPTOM "symptom" |
356 | #define ARCH_SYMPTOM "symptom" |
354 | |
357 | |
355 | extern void (*object_free_callback)(object *ob); // called for every object_free |
|
|
356 | |
|
|
357 | #endif |
358 | #endif |