--- deliantra/server/include/object.h 2006/08/25 17:11:53 1.5 +++ deliantra/server/include/object.h 2006/08/28 16:52:51 1.10 @@ -29,6 +29,9 @@ #ifndef OBJECT_H #define OBJECT_H +#include "cfperl.h" +#include "shstr.h" + typedef uint32 tag_t; #define NUM_BODY_LOCATIONS 12 #define BODY_ARMS 1 @@ -98,7 +101,9 @@ * MSW 2002-07-05 */ -struct object_simple { +struct object_simple : attachable { + static data_type get_dt () { 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 */ @@ -255,7 +260,14 @@ }; struct object : object_special, object_simple { - void *self, *cb; // CF+ perl's self and callback registry + 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 */ @@ -352,6 +364,4 @@ #define ARCH_DEPLETION "depletion" #define ARCH_SYMPTOM "symptom" -extern void (*object_free_callback)(object *ob); // called for every object_free - #endif