--- deliantra/server/include/object.h 2008/04/20 22:03:21 1.162 +++ deliantra/server/include/object.h 2008/04/20 23:25:09 1.163 @@ -379,21 +379,23 @@ MTH const char *debug_desc () const; // uses at least 3 round-robin buffers const char *flag_desc (char *desc, int len) const; - int number_of () const + MTH int number_of () const { return nrof ? nrof : 1; } - uint64 total_weight () const + MTH sint32 total_weight () const { return weight * number_of () + carrying; } + MTH void update_weight (); + // return the dominant material of this item, always return something const materialtype_t *dominant_material () const; // return the volume of this object in cm³ - uint64 volume () const + MTH uint64 volume () const { return total_weight () * 1000 @@ -427,6 +429,14 @@ */ MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } + // returns the outermost environment, never returns 0 + MTH object *outer_env () + { + for (object *op = this; ; op = op->env) + if (!op->env) + return op; + } + // returns the player that has this object in his inventory, or 0 MTH object *in_player () const {