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.11 2006/08/29 05:03:55 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' */ |
… | |
… | |
182 | sint32 weight_limit; /* Weight-limit of object */ |
187 | sint32 weight_limit; /* Weight-limit of object */ |
183 | sint32 carrying; /* How much weight this object contains */ |
188 | sint32 carrying; /* How much weight this object contains */ |
184 | sint8 glow_radius; /* indicates the glow radius of the object */ |
189 | sint8 glow_radius; /* indicates the glow radius of the object */ |
185 | living stats; /* Str, Con, Dex, etc */ |
190 | living stats; /* Str, Con, Dex, etc */ |
186 | sint64 perm_exp; /* Permanent exp */ |
191 | sint64 perm_exp; /* Permanent exp */ |
187 | const char *current_weapon_script; /* The script of the currently used weapon. Executed */ |
|
|
188 | /* each time the object attacks something */ |
|
|
189 | struct object *current_weapon; /* Pointer to the weapon currently used */ |
192 | struct object *current_weapon; /* Pointer to the weapon currently used */ |
190 | uint32 weapontype; /* type of weapon */ |
193 | uint32 weapontype; /* type of weapon */ |
191 | uint32 tooltype; /* type of tool or build facility */ |
194 | uint32 tooltype; /* type of tool or build facility */ |
192 | sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ |
195 | sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ |
193 | sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ |
196 | sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ |
… | |
… | |
253 | const char *custom_name; /* Custom name assigned by player */ |
256 | const char *custom_name; /* Custom name assigned by player */ |
254 | key_value *key_values; /* Fields not explictly known by the loader. */ |
257 | key_value *key_values; /* Fields not explictly known by the loader. */ |
255 | }; |
258 | }; |
256 | |
259 | |
257 | struct object : object_special, object_simple { |
260 | struct object : object_special, object_simple { |
258 | void *self, *cb; // CF+ perl's self and callback registry |
261 | void clone (object *destination) |
|
|
262 | { |
|
|
263 | if (attach) |
|
|
264 | destination->attach = add_refcount (attach); |
|
|
265 | |
|
|
266 | if (self || cb) |
|
|
267 | INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); |
|
|
268 | } |
259 | }; |
269 | }; |
260 | |
270 | |
261 | typedef struct oblnk { /* Used to link together several objects */ |
271 | typedef struct oblnk { /* Used to link together several objects */ |
262 | object *ob; |
272 | object *ob; |
263 | struct oblnk *next; |
273 | struct oblnk *next; |
… | |
… | |
350 | #define ARCH_SINGULARITY_LEN 11 |
360 | #define ARCH_SINGULARITY_LEN 11 |
351 | #define ARCH_DETECT_MAGIC "detect_magic" |
361 | #define ARCH_DETECT_MAGIC "detect_magic" |
352 | #define ARCH_DEPLETION "depletion" |
362 | #define ARCH_DEPLETION "depletion" |
353 | #define ARCH_SYMPTOM "symptom" |
363 | #define ARCH_SYMPTOM "symptom" |
354 | |
364 | |
355 | extern void (*object_free_callback)(object *ob); // called for every object_free |
|
|
356 | |
|
|
357 | #endif |
365 | #endif |