--- deliantra/server/include/object.h 2008/05/17 00:17:02 1.177 +++ deliantra/server/include/object.h 2008/10/06 18:26:35 1.186 @@ -177,7 +177,7 @@ float ACC (RW, speed); /* The overall speed of this object */ float ACC (RW, speed_left); /* How much speed is left to spend this round */ - uint32 ACC (RW, nrof); /* How many of the objects */ + sint32 ACC (RW, nrof); /* How many of the objects */ /* This next big block is basically used for monsters and equipment */ uint16 ACC (RW, client_type); /* Public type information. see doc/Developers/objects */ @@ -262,15 +262,17 @@ uint16 ACC (RW, animation_id);/* An index into the animation array */ uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ uint8 ACC (RW, last_anim); /* last sequence used to draw face */ - sint16 ACC (RW, elevation); /* elevation of this terrain - not currently used */ uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ uint8 ACC (RW, will_apply); /* See crossfire.doc */ + uint16 ACC (RW, cached_sp); /* cached spell points used for a spell, used by esrv_update_spells */ + uint16 ACC (RW, cached_grace);/* cached grace points used for a spell, used by esrv_update_spells */ + uint16 ACC (RW, cached_eat); /* cached food, used by esrv_update_spells */ }; struct object : zero_initialised, object_copy { // These variables are not changed by ->copy_to - maptile_ptr ACC (RW, map); /* Pointer to the map in which this object is present */ + maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. int ACC (RO, count); @@ -344,7 +346,12 @@ MTH object *deep_clone (); // copy whole more chain and inventory void do_destroy (); void gather_callbacks (AV *&callbacks, event_type event) const; - MTH void destroy (bool destroy_inventory = false); + MTH void destroy (); + MTH void drop_and_destroy () + { + destroy_inv (true); + destroy (); + } // recursively destroy all objects in inventory, optionally dropping them to the ground instead MTH void destroy_inv (bool drop_to_ground = false); @@ -441,6 +448,7 @@ / dominant_material ()->density; } + MTH bool is_wiz () const { return flag [FLAG_WIZ]; } MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET || type == CLOAK || type == BOOTS || type == GLOVES @@ -467,20 +475,28 @@ */ MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } + MTH bool has_dialogue () const { return *&msg == '@'; } + // returns the outermost owner, never returns 0 MTH object *outer_owner () { - for (object *op = this; ; op = op->owner) - if (!op->owner) - return op; + object *op; + + for (op = this; op->owner; op = op->owner) + ; + + return op; } // returns the outermost environment, never returns 0 MTH object *outer_env () { - for (object *op = this; ; op = op->env) - if (!op->env) - return op; + object *op; + + for (op = this; op->env; op = op->env) + ; + + return op; } // returns the player that has this object in his inventory, or 0 @@ -508,6 +524,11 @@ return !env && !flag [FLAG_REMOVED]; } + MTH bool is_in_map_or_inv () const + { + return !flag [FLAG_REMOVED]; + } + // returns the player that cna see this object, if any MTH object *visible_to () const;