--- deliantra/server/common/object.C 2007/01/08 01:19:02 1.111 +++ deliantra/server/common/object.C 2007/01/08 14:11:04 1.112 @@ -397,9 +397,11 @@ object * find_object (tag_t i) { - return ((unsigned int)i) < objects.size () - ? objects [i] - : 0; + for_all_objects (op) + if (op->count == i) + return op; + + return 0; } /* @@ -675,10 +677,13 @@ free_key_values (this); } +static int object_count; + void object::link () { - assert (!count);//D + assert (!index);//D uuid = gen_uuid (); + count = ++object_count; refcnt_inc (); objects.insert (this); @@ -686,7 +691,7 @@ void object::unlink () { - assert (count);//D + assert (index);//D objects.erase (this); refcnt_dec (); } @@ -807,6 +812,8 @@ void object::do_destroy () { + attachable::do_destroy (); + if (flag [FLAG_IS_LINKED]) remove_button_link (this); @@ -816,18 +823,13 @@ if (!flag [FLAG_REMOVED]) remove (); - if (flag [FLAG_FREED]) - return; + destroy_inv (true); - set_speed (0); + deactivate (); + unlink (); flag [FLAG_FREED] = 1; - attachable::do_destroy (); - - destroy_inv (true); - unlink (); - // hack to ensure that freed objects still have a valid map { static maptile *freed_map; // freed objects are moved here to avoid crashes