--- deliantra/server/common/object.C 2010/04/03 02:29:40 1.319 +++ deliantra/server/common/object.C 2010/04/07 19:54:44 1.320 @@ -941,6 +941,27 @@ } } +/* + * Remove and free all objects in the inventory of the given object. + * Unlike destroy_inv, this assumes the *this is destroyed as well + * well, so we can (and have to!) take shortcuts. + */ +void +object::destroy_inv_fast () +{ + while (object *op = inv) + { + // remove from object the fast way + op->flag [FLAG_REMOVED] = true; + op->env = 0; + if ((inv = inv->below)) + inv->above = 0; + + // then destroy + op->destroy (); + } +} + object *object::create () { object *op = new object; @@ -1020,7 +1041,7 @@ return; } - destroy_inv (false); + destroy_inv_fast (); if (is_head ()) if (sound_destroy)