--- deliantra/server/include/object.h 2006/09/11 20:28:37 1.28 +++ deliantra/server/include/object.h 2006/09/12 19:20:07 1.33 @@ -101,7 +101,7 @@ * This is typically the container that the object is in. */ struct object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ - struct object *ACC (RW, head); /* Points to the main object of a large body */ + struct object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */ }; @@ -170,7 +170,6 @@ uint32 ACC (RW, tooltype); /* type of tool or build facility */ sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ - uint8 ACC (RW, will_apply); /* See crossfire.doc */ /* See the doc/Developers/objects for more info about body locations */ /* Following mostly refers to fields only used for monsters */ @@ -214,6 +213,7 @@ uint8 ACC (RW, last_anim); /* last sequence used to draw face */ sint32 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 */ MoveType ACC (RW, move_type); /* Type of movement this object uses */ MoveType ACC (RW, move_block); /* What movement types this blocks */ @@ -239,6 +239,45 @@ void set_owner (object *owner); object *get_owner (); + // info must hold 256 * 3 bytes currently + const char *debug_desc (char *info) const; + const char *debug_desc () const; + + // fully recursive iterator + struct iterator_base + { + object *item; + + iterator_base (object *container) + : item (container) + { + } + + operator object *() const { return item; } + + object *operator ->() const { return item; } + object &operator * () const { return *item; } + }; + + // depth-first recursive iterator + struct depth_iterator : iterator_base + { + depth_iterator (object *container); + void next (); + object *operator ++( ) { next (); return item; } + object *operator ++(int) { object *i = item; next (); return i; } + }; + + object *begin () + { + return this; + } + + object *end () + { + return this; + } + protected: friend struct archetype;