--- deliantra/server/common/object.C 2006/12/26 08:54:59 1.87 +++ deliantra/server/common/object.C 2006/12/26 09:37:00 1.88 @@ -806,6 +806,12 @@ flag [FLAG_FREED] = 1; + while (inv) + inv->destroy (); + + set_speed (0); + unlink (); + // hack to ensure that freed objects still have a valid map { static maptile *freed_map; // freed objects are moved here to avoid crashes @@ -826,9 +832,13 @@ y = 1; } - more = 0; head = 0; - inv = 0; + + if (more) + { + more->destroy (); + more = 0; + } // clear those pointers that likely might have circular references to us owner = 0; @@ -837,11 +847,6 @@ // only relevant for players(?), but make sure of it anyways contr = 0; - - /* Remove object from the active list */ - set_speed (0); - - unlink (); } /* @@ -851,9 +856,6 @@ void object::destroy_inv (bool drop_to_ground) { - if (!inv) - return; - /* Only if the space blocks everything do we not process - * if some form of movement is allowed, let objects * drop on that space. @@ -861,10 +863,7 @@ if (!drop_to_ground || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) { while (inv) - { - inv->destroy_inv (drop_to_ground); - inv->destroy (); - } + inv->destroy (); } else { /* Put objects in inventory onto this space */ @@ -895,13 +894,6 @@ if (destroyed ()) return; - if (more) - { - //TODO: non-head objects must not have inventory - more->destroy (destroy_inventory); - more = 0; - } - if (destroy_inventory) destroy_inv (true);