--- deliantra/server/include/object.h 2006/08/26 08:44:06 1.6 +++ deliantra/server/include/object.h 2006/08/26 23:36:32 1.7 @@ -30,6 +30,7 @@ #define OBJECT_H #include "cfperl.h" +#include "shstr.h" typedef uint32 tag_t; #define NUM_BODY_LOCATIONS 12 @@ -100,7 +101,9 @@ * MSW 2002-07-05 */ -struct object_simple { +struct object_simple : extendable { + data_type get_dt () const { return DT_OBJECT; } + /* These variables are not changed by copy_object() */ struct pl *contr; /* Pointer to the player which control this object */ struct object *next; /* Pointer to the next object in the free/used list */ @@ -127,9 +130,7 @@ uint16 refcount; /* How many objects points to this object */ }; -struct object_special : extendable { - data_type get_dt () const { return DT_OBJECT; } - +struct object_special { /* These get an extra add_refcount(), after having been copied by memcpy(). * All fields beow this point are automatically copied by memcpy. If * adding something that needs a refcount updated, make sure you modify @@ -259,6 +260,24 @@ }; struct object : object_special, object_simple { + void instantiate_ (); + void instantiate () + { + if (attach) + { + instantiate_ (); + free_string (attach); + attach = 0; + } + } + void clone (object *destination) + { + if (attach) + destination->attach = add_refcount (attach); + + if (self || cb) + INVOKE_OBJECT (CLONE, this, ARG_OBJECT (destination)); + } }; typedef struct oblnk { /* Used to link together several objects */