--- deliantra/server/common/object.C 2006/12/26 09:37:00 1.88 +++ deliantra/server/common/object.C 2006/12/26 10:14:24 1.90 @@ -780,6 +780,45 @@ next = 0; } +/* + * Remove and free all objects in the inventory of the given object. + * object.c ? + */ +void +object::destroy_inv (bool drop_to_ground) +{ + /* Only if the space blocks everything do we not process - + * if some form of movement is allowed, let objects + * drop on that space. + */ + if (!drop_to_ground || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) + { + while (inv) + inv->destroy (); + } + else + { /* Put objects in inventory onto this space */ + while (inv) + { + object *op = inv; + + if (op->flag [FLAG_STARTEQUIP] + || op->flag [FLAG_NO_DROP] + || op->type == RUNE + || op->type == TRAP + || op->flag [FLAG_IS_A_TEMPLATE]) + op->destroy (); + else + { + op->remove (); + op->x = x; + op->y = y; + insert_ob_in_map (op, map, 0, 0); /* Insert in same map as the envir */ + } + } + } +} + object *object::create () { object *op = new object; @@ -790,8 +829,6 @@ void object::do_destroy () { - attachable::do_destroy (); - if (flag [FLAG_IS_LINKED]) remove_button_link (this); @@ -806,9 +843,9 @@ flag [FLAG_FREED] = 1; - while (inv) - inv->destroy (); + attachable::do_destroy (); + destroy_inv (true); set_speed (0); unlink (); @@ -849,45 +886,6 @@ contr = 0; } -/* - * Remove and free all objects in the inventory of the given object. - * object.c ? - */ -void -object::destroy_inv (bool drop_to_ground) -{ - /* Only if the space blocks everything do we not process - - * if some form of movement is allowed, let objects - * drop on that space. - */ - if (!drop_to_ground || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) - { - while (inv) - inv->destroy (); - } - else - { /* Put objects in inventory onto this space */ - while (inv) - { - object *op = inv; - - if (op->flag [FLAG_STARTEQUIP] - || op->flag [FLAG_NO_DROP] - || op->type == RUNE - || op->type == TRAP - || op->flag [FLAG_IS_A_TEMPLATE]) - op->destroy (); - else - { - op->remove (); - op->x = x; - op->y = y; - insert_ob_in_map (op, map, 0, 0); /* Insert in same map as the envir */ - } - } - } -} - void object::destroy (bool destroy_inventory) { @@ -895,7 +893,7 @@ return; if (destroy_inventory) - destroy_inv (true); + destroy_inv (false); attachable::destroy (); } @@ -1018,7 +1016,7 @@ int check_walk_off = !flag [FLAG_NO_APPLY]; - for (tmp = GET_MAP_OB (map, x, y); tmp; tmp = tmp->above) + for (tmp = map->at (x, y).bot; tmp; tmp = tmp->above) { /* No point updating the players look faces if he is the object * being removed. @@ -1049,6 +1047,7 @@ if (destroyed ()) LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); + LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); } /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */