--- deliantra/server/include/object.h 2006/12/18 17:39:17 1.58 +++ deliantra/server/include/object.h 2006/12/20 09:14:22 1.60 @@ -122,6 +122,7 @@ object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ + client_container *seen_by; // seen by which player/container currently? }; // these are being copied @@ -304,6 +305,16 @@ */ bool has_random_items () const { return randomitems && !flags [FLAG_IS_A_TEMPLATE]; } + // returns the player that has this object in his inventory, or 0 + object *in_player () const + { + for (object *op = env; op; op = op->env) + if (op->type == PLAYER) + return op; + + return 0; + } + // fully recursive iterator struct iterator_base { @@ -401,7 +412,7 @@ /* This returns TRUE if the object is something that * should be displayed in the look window */ -#define LOOK_OBJ(ob) (!ob->invisible && ob->type!=PLAYER && ob->type!=EVENT_CONNECTOR) +#define LOOK_OBJ(ob) (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) /* Used by update_object to know if the object being passed is * being added or removed.