… | |
… | |
30 | #include "cfperl.h" |
30 | #include "cfperl.h" |
31 | #include "shstr.h" |
31 | #include "shstr.h" |
32 | |
32 | |
33 | typedef int tag_t; |
33 | typedef int tag_t; |
34 | |
34 | |
35 | #define NUM_BODY_LOCATIONS 14 |
35 | enum { |
36 | #define BODY_ARMS 1 |
36 | body_range, |
|
|
37 | body_shield, |
|
|
38 | body_combat, |
|
|
39 | body_arm, |
|
|
40 | body_torso, |
|
|
41 | body_head, |
|
|
42 | body_neck, |
|
|
43 | body_skill, |
|
|
44 | body_finger, |
|
|
45 | body_shoulder, |
|
|
46 | body_foot, |
|
|
47 | body_hand, |
|
|
48 | body_wrist, |
|
|
49 | body_waist, |
|
|
50 | NUM_BODY_LOCATIONS |
|
|
51 | }; |
37 | |
52 | |
38 | /* See common/item.c */ |
53 | /* See common/item.c */ |
39 | |
54 | |
40 | typedef struct Body_Locations |
55 | typedef struct Body_Locations |
41 | { |
56 | { |
… | |
… | |
252 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
267 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
253 | client_container *seen_by; // seen by which player/container currently? |
268 | client_container *seen_by; // seen by which player/container currently? |
254 | key_value *key_values; /* Fields not explictly known by the loader. */ |
269 | key_value *key_values; /* Fields not explictly known by the loader. */ |
255 | |
270 | |
256 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
271 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
|
|
272 | void post_load_check (); // do some adjustments after parsing |
257 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
273 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
258 | bool write (object_freezer &f); |
274 | bool write (object_freezer &f); |
259 | |
275 | |
260 | MTH static object *create (); |
276 | MTH static object *create (); |
261 | object &operator =(const object &src); |
277 | object &operator =(const object &src); |
… | |
… | |
271 | void do_remove (); |
287 | void do_remove (); |
272 | MTH void remove () |
288 | MTH void remove () |
273 | { |
289 | { |
274 | if (!flag [FLAG_REMOVED]) |
290 | if (!flag [FLAG_REMOVED]) |
275 | do_remove (); |
291 | do_remove (); |
|
|
292 | } |
|
|
293 | |
|
|
294 | // move this object to the top of its env's inventory to speed up |
|
|
295 | // searches for it. |
|
|
296 | MTH void inv_splay () |
|
|
297 | { |
|
|
298 | if (env && env->inv != this) |
|
|
299 | { |
|
|
300 | if (above) above->below = below; |
|
|
301 | if (below) below->above = above; |
|
|
302 | |
|
|
303 | above = 0; |
|
|
304 | below = env->inv; |
|
|
305 | below->above = this; |
|
|
306 | env->inv = this; |
|
|
307 | } |
276 | } |
308 | } |
277 | |
309 | |
278 | static bool can_merge_slow (object *op1, object *op2); |
310 | static bool can_merge_slow (object *op1, object *op2); |
279 | |
311 | |
280 | // this is often used in time-critical code, so optimise |
312 | // this is often used in time-critical code, so optimise |