ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/object.h
(Generate patch)

Comparing deliantra/server/include/object.h (file contents):
Revision 1.28 by root, Mon Sep 11 20:28:37 2006 UTC vs.
Revision 1.31 by root, Tue Sep 12 01:26:07 2006 UTC

99 */ 99 */
100 struct object *ACC (RW, env); /* Pointer to the object which is the environment. 100 struct object *ACC (RW, env); /* Pointer to the object which is the environment.
101 * This is typically the container that the object is in. 101 * This is typically the container that the object is in.
102 */ 102 */
103 struct object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ 103 struct object *ACC (RW, more); /* Pointer to the rest of a large body of objects */
104 struct object *ACC (RW, head); /* Points to the main object of a large body */ 104 struct object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different
105 struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */ 105 struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */
106}; 106};
107 107
108// these are being copied 108// these are being copied
109struct object_copy : attachable<object> 109struct object_copy : attachable<object>
237 void clone (object *destination); 237 void clone (object *destination);
238 238
239 void set_owner (object *owner); 239 void set_owner (object *owner);
240 object *get_owner (); 240 object *get_owner ();
241 241
242 // fully recursive iterator
243 struct iterator_base
244 {
245 object *item;
246
247 iterator_base (object *container)
248 : item (container)
249 {
250 }
251
252 operator object *() const { return item; }
253
254 object *operator ->() const { return item; }
255 object &operator * () const { return *item; }
256 };
257
258 // depth-first recursive iterator
259 struct depth_iterator : iterator_base
260 {
261 depth_iterator (object *container);
262 void next ();
263 object *operator ++( ) { next (); return item; }
264 object *operator ++(int) { object *i = item; next (); return i; }
265 };
266
267 object *begin ()
268 {
269 return this;
270 }
271
272 object *end ()
273 {
274 return this;
275 }
276
242protected: 277protected:
243 friend struct archetype; 278 friend struct archetype;
244 279
245 void link (); 280 void link ();
246 void unlink (); 281 void unlink ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines