--- deliantra/server/common/treasure.C 2008/04/20 00:44:12 1.72 +++ deliantra/server/common/treasure.C 2008/09/29 10:31:32 1.81 @@ -34,7 +34,6 @@ #include #include -#include #include extern char *spell_mapping[]; @@ -48,8 +47,7 @@ treasurelist *, str_hash, str_equal, - slice_allocator< std::pair >, - true + slice_allocator< std::pair > > tl_map_t; static tl_map_t tl_map; @@ -147,10 +145,11 @@ { case KW_arch: t->item = archetype::find (f.get_str ()); + if (!t->item) { f.parse_warn ("treasure references unknown archetype"); - goto error; + t->item = archetype::empty; } break; @@ -251,14 +250,14 @@ //TODO: flag such as objects... as such (no drop, anybody?) if (op->type == SPELL) { - op->destroy (); + op->destroy (true); return; } op->expand_tail (); - if (op->blocked (creator->map, creator->x, creator->y)) - op->destroy (); + if (!creator->is_on_map () || op->blocked (creator->map, creator->x, creator->y)) + op->destroy (true); else { SET_FLAG (op, FLAG_OBJ_ORIGINAL); @@ -271,10 +270,6 @@ if ((flags & GT_APPLY) && QUERY_FLAG (creator, FLAG_MONSTER)) monster_check_apply (creator, op); - - if (flags & GT_UPDATE_INV) - if (object *tmp = creator->in_player ()) - esrv_send_item (tmp, op); } } @@ -447,7 +442,8 @@ if (ob->inv) LOG (llevError, "In generate treasure, created multiple objects.\n"); - ob->destroy (); + ob->destroy (true); + return tmp; } @@ -584,14 +580,17 @@ if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */ magic = (-magic); + op->weight = (op->arch->weight * (100 - magic * 10)) / 100; } else { if (op->type == ARMOUR) ARMOUR_SPEED (op) = (ARMOUR_SPEED (op) * (100 + magic * 10)) / 100; + if (magic < 0 && !(rndm (3))) /* You can't just check the weight always */ magic = (-magic); + op->weight = (op->weight * (100 - magic * 10)) / 100; } } @@ -969,13 +968,6 @@ op->value *= 5; /* Since it's not just decoration */ case RING: - if (!op->arch) // wtf? schmorp - { - op->destroy (); - op = 0; - break; - } - if (!IS_ARCH (op->arch, ring) && !IS_ARCH (op->arch, amulet)) /* It's a special artifact! */ break; @@ -1357,14 +1349,11 @@ */ if (op->type == HORN || op->type == POTION) { - object *tmp_obj; - /* Remove any spells this object currently has in it */ - while (op->inv) - op->inv->destroy (); + op->destroy_inv (false); - tmp_obj = arch_to_object (change->other_arch); - insert_ob_in_ob (tmp_obj, op); + object *tmp = arch_to_object (change->other_arch); + insert_ob_in_ob (tmp, op); } /* No harm setting this for potions/horns */ op->other_arch = change->other_arch; @@ -1690,7 +1679,7 @@ if (at->next) free_artifact (at->next); if (at->allowed) free_charlinks (at->allowed); - at->item->destroy (1); + at->item->destroy (true); sfree (at); }