--- deliantra/server/common/object.C 2007/02/10 15:20:23 1.131 +++ deliantra/server/common/object.C 2007/02/16 19:43:40 1.133 @@ -359,7 +359,6 @@ * Some error messages. * The result of the dump is stored in the static global errmsg array. */ - char * dump_object (object *op) { @@ -367,7 +366,7 @@ return strdup ("[NULLOBJ]"); object_freezer freezer; - save_object (freezer, op, 1); + op->write (freezer); return freezer.as_string (); } @@ -526,6 +525,24 @@ dst->set_speed (dst->speed); } +void +object::instantiate () +{ + if (!uuid.seq) // HACK + uuid = gen_uuid (); + + speed_left = -0.1f; + /* copy the body_info to the body_used - this is only really + * need for monsters, but doesn't hurt to do it for everything. + * by doing so, when a monster is created, it has good starting + * values for the body_used info, so when items are created + * for it, they can be properly equipped. + */ + memcpy (body_used, body_info, sizeof (body_used)); + + attachable::instantiate (); +} + object * object::clone () { @@ -2336,44 +2353,6 @@ return dst; } -/* GROS - Creates an object using a string representing its content. */ -/* Basically, we save the content of the string to a temp file, then call */ -/* load_object on it. I admit it is a highly inefficient way to make things, */ -/* but it was simple to make and allows reusing the load_object function. */ -/* Remember not to use load_object_str in a time-critical situation. */ -/* Also remember that multiparts objects are not supported for now. */ -object * -load_object_str (const char *obstr) -{ - object *op; - char filename[MAX_BUF]; - - sprintf (filename, "%s/cfloadobstr2044", settings.tmpdir); - - FILE *tempfile = fopen (filename, "w"); - - if (tempfile == NULL) - { - LOG (llevError, "Error - Unable to access load object temp file\n"); - return NULL; - } - - fprintf (tempfile, obstr); - fclose (tempfile); - - op = object::create (); - - object_thawer thawer (filename); - - if (thawer) - load_object (thawer, op, 0); - - LOG (llevDebug, " load str completed, object=%s\n", &op->name); - CLEAR_FLAG (op, FLAG_REMOVED); - - return op; -} - /* This returns the first object in who's inventory that * has the same type and subtype match. * returns NULL if no match. @@ -2641,9 +2620,6 @@ if (container == new_container) return; - if (contr && contr->ns) - contr->ns->floorbox_reset (); - if (object *old_container = container) { if (INVOKE_OBJECT (CLOSE, old_container, ARG_OBJECT (this))) @@ -2679,12 +2655,13 @@ } #endif + new_draw_info_format (NDI_UNIQUE, 0, this, "You open %s.", query_name (new_container)); + new_container->flag [FLAG_APPLIED] = 1; container = new_container; esrv_update_item (UPD_FLAGS, this, new_container); esrv_send_inventory (this, new_container); - new_draw_info_format (NDI_UNIQUE, 0, this, "You open %s.", query_name (new_container)); } }