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.40 by root, Sat Sep 16 22:24:12 2006 UTC vs.
Revision 1.43 by root, Sun Oct 15 02:16:35 2006 UTC

79 79
80/* However, if you're keeping a pointer of some sort, you probably 80/* However, if you're keeping a pointer of some sort, you probably
81 * don't just want it copied, so you'll need to add to common/object.C, 81 * don't just want it copied, so you'll need to add to common/object.C,
82 * e.g. copy_object. 82 * e.g. copy_object.
83 */ 83 */
84
85typedef refptr<object> object_ptr;
84 86
85// these are not being copied 87// these are not being copied
86ACC_CLASS (object) 88ACC_CLASS (object)
87struct object_keep : refcounted 89struct object_keep : refcounted
88{ 90{
125 shstr ACC (RW, msg); /* If this is a book/sign/magic mouth/etc */ 127 shstr ACC (RW, msg); /* If this is a book/sign/magic mouth/etc */
126 shstr ACC (RW, lore); /* Obscure information about this object, */ 128 shstr ACC (RW, lore); /* Obscure information about this object, */
127 /* To get put into books and the like. */ 129 /* To get put into books and the like. */
128 shstr ACC (RW, materialname); /* specific material name */ 130 shstr ACC (RW, materialname); /* specific material name */
129 shstr ACC (RW, custom_name); /* Custom name assigned by player */ 131 shstr ACC (RW, custom_name); /* Custom name assigned by player */
130 refptr<object> ACC (RW, owner); /* Pointer to the object which controls this one */ 132 object_ptr ACC (RW, owner); /* Pointer to the object which controls this one */
131 refptr<object> ACC (RW, enemy); /* Monster/player to follow even if not closest */ 133 object_ptr ACC (RW, enemy); /* Monster/player to follow even if not closest */
132 refptr<object> ACC (RW, attacked_by); /* This object start to attack us! only player & monster */ 134 object_ptr ACC (RW, attacked_by); /* This object start to attack us! only player & monster */
133 refptr<object> ACC (RW, chosen_skill); /* the skill chosen to use */ 135 object_ptr ACC (RW, chosen_skill); /* the skill chosen to use */
134 refptr<object> ACC (RW, spellitem); /* Spell ability monster is choosing to use */ 136 object_ptr ACC (RW, spellitem); /* Spell ability monster is choosing to use */
135 refptr<object> ACC (RW, spell); /* Spell that was being cast */ 137 object_ptr ACC (RW, spell); /* Spell that was being cast */
136 refptr<object> ACC (RW, current_weapon); /* Pointer to the weapon currently used */ 138 object_ptr ACC (RW, current_weapon); /* Pointer to the weapon currently used */
137}; 139};
138 140
139// these are being copied and also cleared 141// these are being copied and also cleared
140struct object_pod 142struct object_pod
141{ 143{
238 static vector active; // active objects, not yet used 240 static vector active; // active objects, not yet used
239 static vector objects; // not used yet, use first->next->... 241 static vector objects; // not used yet, use first->next->...
240 static object *first; // will be replaced by "objects" 242 static object *first; // will be replaced by "objects"
241 243
242 static object *create (); 244 static object *create ();
243 void free (bool free_inventory = false); 245 void destroy (bool destroy_inventory = false);
244 246
245 static void free_mortals (); 247 static void free_mortals ();
246 static bool can_merge (object *op1, object *op2); 248 static bool can_merge (object *op1, object *op2);
247 249
248 void clear (); 250 void clear ();
308 object (); 310 object ();
309 ~object (); 311 ~object ();
310}; 312};
311 313
312#define get_object() object::create () 314#define get_object() object::create ()
313#define free_object(op) (op)->free (0) 315#define free_object(op) (op)->destroy (0)
314#define free_object2(op, free_inv) (op)->free (free_inv) 316#define free_object2(op, free_inv) (op)->destroy (free_inv)
315#define clear_owner(op) (op)->owner = 0 317#define clear_owner(op) (op)->owner = 0
316#define copy_owner(op,other) (op)->owner = (other)->owner 318#define copy_owner(op,other) (op)->owner = (other)->owner
317#define get_owner(op) (op)->owner 319#define get_owner(op) (op)->owner
318#define clear_object(op) (op)->clear () 320#define clear_object(op) (op)->clear ()
319 321
325 327
326#define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2))) 328#define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2)))
327 329
328typedef struct oblnk 330typedef struct oblnk
329{ /* Used to link together several objects */ 331{ /* Used to link together several objects */
330 object *ob; 332 object_ptr ob;
331 struct oblnk *next; 333 struct oblnk *next;
332 tag_t id;
333} objectlink; 334} objectlink;
334 335
335typedef struct oblinkpt 336typedef struct oblinkpt
336{ /* Used to link together several object links */ 337{ /* Used to link together several object links */
337 struct oblnk *link; 338 struct oblnk *link;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines