--- deliantra/server/common/object.C 2006/08/13 17:16:00 1.1 +++ deliantra/server/common/object.C 2006/08/29 05:03:54 1.7 @@ -1,6 +1,6 @@ /* * static char *rcsid_object_c = - * "$Id: object.C,v 1.1 2006/08/13 17:16:00 elmex Exp $"; + * "$Id: object.C,v 1.7 2006/08/29 05:03:54 root Exp $"; */ /* @@ -54,8 +54,6 @@ object *free_objects; /* Pointer to the list of unused objects */ object *active_objects; /* List of active objects that need to be processed */ -void (*object_free_callback)(object *ob); - short freearr_x[SIZEOFFREE]= {0,0,1,1,1,0,-1,-1,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1, 0,1,2,3,3,3,3,3,3,3,2,1,0,-1,-2,-3,-3,-3,-3,-3,-3,-3,-2,-1}; @@ -550,7 +548,6 @@ op->msg = NULL; op->materialname = NULL; op->lore = NULL; - op->current_weapon_script = NULL; clear_object(op); } @@ -583,6 +580,7 @@ */ void clear_object(object *op) { + op->clear (); event *evt; event *evt2; @@ -663,6 +661,8 @@ int is_freed=QUERY_FLAG(op,FLAG_FREED),is_removed=QUERY_FLAG(op,FLAG_REMOVED); event *evt, *evt2, *evt_new; + op->clear (); + /* Decrement the refcounts, but don't bother zeroing the fields; they'll be overwritten by memcpy. */ if(op->name!=NULL) free_string(op->name); @@ -691,6 +691,7 @@ free_key_values(op); *(object_special *)op = *(object_special *)op2; + op2->clone (op); if(is_freed) SET_FLAG(op,FLAG_FREED); if(is_removed) SET_FLAG(op,FLAG_REMOVED); @@ -756,7 +757,7 @@ } } } - + update_ob_speed(op); } @@ -1065,8 +1066,7 @@ void free_object2(object *ob, int free_inventory) { object *tmp,*op; - if (object_free_callback) - object_free_callback (ob); + ob->clear (); if (!QUERY_FLAG(ob,FLAG_REMOVED)) { LOG(llevDebug,"Free object called with non removed object\n"); @@ -2640,7 +2640,8 @@ LOG(llevError,"Error - Unable to read object temp file\n"); return NULL; }; - load_object(tempfile,op,LO_NEWFILE,0); + object_thawer thawer (tempfile); + load_object(thawer,op,LO_NEWFILE,0); LOG(llevDebug," load str completed, object=%s\n",op->name); CLEAR_FLAG(op,FLAG_REMOVED); fclose(tempfile);