--- deliantra/server/common/object.C 2008/04/22 07:28:05 1.215 +++ deliantra/server/common/object.C 2008/04/23 21:09:10 1.219 @@ -919,7 +919,7 @@ // need to check first, because the checks below might segfault // as we might be on an invalid mapspace and crossfire code // is too buggy to ensure that the inventory is empty. - // corollary: if you create arrows etc. with stuff in tis inventory, + // corollary: if you create arrows etc. with stuff in its inventory, // cf will crash below with off-map x and y if (!inv) return; @@ -936,7 +936,7 @@ { while (inv) { - inv->destroy_inv (drop_to_ground); + inv->destroy_inv (false); inv->destroy (); } } @@ -952,7 +952,7 @@ || op->type == TRAP || op->flag [FLAG_IS_A_TEMPLATE] || op->flag [FLAG_DESTROY_ON_DEATH]) - op->destroy (); + op->destroy (true); else map->insert (op, x, y); } @@ -979,8 +979,6 @@ attachable::do_destroy (); - destroy_inv (true); - deactivate (); unlink (); @@ -1030,8 +1028,13 @@ if (destroyed ()) return; - if (destroy_inventory) - destroy_inv (false); + if (!is_head () && !head->destroyed ()) + { + LOG (llevError | logBacktrace, "tried to destroy the tail of an object"); + head->destroy (destroy_inventory); + } + + destroy_inv (!destroy_inventory); if (is_head ()) if (sound_destroy) @@ -1154,7 +1157,8 @@ */ pl->close_container (); - pl->contr->ns->floorbox_update (); + //TODO: the floorbox prev/next might need updating + esrv_del_item (pl->contr, count); } for (tmp = ms.bot; tmp; tmp = tmp->above) @@ -1290,8 +1294,6 @@ { assert (!op->flag [FLAG_FREED]); - object *top, *floor = NULL; - op->remove (); /* Ideally, the caller figures this out. However, it complicates a lot @@ -1300,7 +1302,7 @@ */ if (!xy_normalise (m, op->x, op->y)) { - op->destroy (); + op->destroy (1); return 0; } @@ -1319,6 +1321,9 @@ for (object *tmp = ms.bot; tmp; tmp = tmp->above) if (object::can_merge (op, tmp)) { + // TODO: we atcually want to update tmp, not op, + // but some caller surely breaks when we return tmp + // from here :/ op->nrof += tmp->nrof; tmp->destroy (1); } @@ -1350,6 +1355,8 @@ } else { + object *top, *floor = NULL; + top = ms.bot; /* If there are other objects, then */ @@ -1458,7 +1465,8 @@ op->map->dirty = true; if (object *pl = ms.player ()) - pl->contr->ns->floorbox_update (); + //TODO: the floorbox prev/next might need updating + esrv_send_item (pl, op); /* If this object glows, it may affect lighting conditions that are * visible to others on this map. But update_all_los is really @@ -2569,7 +2577,7 @@ title ? (const char *)title : "", flag_desc (flagdesc, 512), type); - if (!this->flag[FLAG_REMOVED] && env) + if (!flag[FLAG_REMOVED] && env) p += snprintf (p, 256, "(in %s)", env->debug_desc (info2)); if (map) @@ -2621,7 +2629,7 @@ closer->destroy (); #endif - old_container->flag [FLAG_APPLIED] = 0; + old_container->flag [FLAG_APPLIED] = false; container = 0; esrv_update_item (UPD_FLAGS, this, old_container); @@ -2647,7 +2655,7 @@ new_draw_info_format (NDI_UNIQUE, 0, this, "You open %s.", query_name (new_container)); - new_container->flag [FLAG_APPLIED] = 1; + new_container->flag [FLAG_APPLIED] = true; container = new_container; esrv_update_item (UPD_FLAGS, this, new_container);