--- deliantra/server/include/object.h 2006/12/18 03:00:02 1.57 +++ deliantra/server/include/object.h 2006/12/21 01:33:50 1.61 @@ -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 @@ -302,7 +303,20 @@ /* This return true if object has still randomitems which * could be expanded. */ - bool has_random_items () const { return randomitems && flags [FLAG_IS_A_TEMPLATE]; } + 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; + } + + // returns the mapspace this object is in + mapspace &ms () const; // fully recursive iterator struct iterator_base @@ -401,7 +415,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.