--- deliantra/server/include/object.h 2007/05/07 04:21:11 1.117 +++ deliantra/server/include/object.h 2007/05/12 16:06:42 1.120 @@ -32,8 +32,23 @@ typedef int tag_t; -#define NUM_BODY_LOCATIONS 14 -#define BODY_ARMS 1 +enum { + body_range, + body_shield, + body_combat, + body_arm, + body_torso, + body_head, + body_neck, + body_skill, + body_finger, + body_shoulder, + body_foot, + body_hand, + body_wrist, + body_waist, + NUM_BODY_LOCATIONS +}; /* See common/item.c */ @@ -254,6 +269,7 @@ key_value *key_values; /* Fields not explictly known by the loader. */ bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all + void post_load_check (); // do some adjustments after parsing static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. bool write (object_freezer &f); @@ -275,6 +291,22 @@ do_remove (); } + // move this object to the top of its env's inventory to speed up + // searches for it. + MTH void inv_splay () + { + if (env && env->inv != this) + { + if (above) above->below = below; + if (below) below->above = above; + + above = 0; + below = env->inv; + below->above = this; + env->inv = this; + } + } + static bool can_merge_slow (object *op1, object *op2); // this is often used in time-critical code, so optimise @@ -287,7 +319,7 @@ MTH void set_owner (object *owner); MTH void set_speed (float speed); - MTH void set_weapon (object *ob); + MTH bool change_weapon (object *ob); MTH void open_container (object *new_container); MTH void close_container ()