--- deliantra/server/common/map.C 2008/05/04 19:14:23 1.139 +++ deliantra/server/common/map.C 2008/09/29 10:31:32 1.148 @@ -24,9 +24,7 @@ #include #include "global.h" - #include "loader.h" - #include "path.h" /* This rolls up wall, blocks_magic, blocks_view, etc, all into @@ -262,6 +260,19 @@ tmp->flag [flag] = value; } +void +maptile::post_load_original () +{ + if (!spaces) + return; + + set_object_flag (FLAG_OBJ_ORIGINAL); + + for (mapspace *ms = spaces + size (); ms-- > spaces; ) + for (object *tmp = ms->bot; tmp; tmp = tmp->above) + INVOKE_OBJECT (RESET, tmp); +} + /* link_multipart_objects go through all the objects on the map looking * for objects whose arch says they are multipart yet according to the * info we have, they only have the head (as would be expected when @@ -643,6 +654,7 @@ case KW_per_player: thawer.get (per_player); break; case KW_per_party: thawer.get (per_party); break; case KW_no_reset: thawer.get (no_reset); break; + case KW_no_drop: thawer.get (no_drop); break; case KW_region: default_region = region::find (thawer.get_str ()); break; case KW_shopitems: shopitems = parse_shop_string (thawer.get_str ()); break; @@ -702,10 +714,7 @@ unique = 1; if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) - { - op->destroy_inv (false); - op->destroy (); - } + op->destroy (); op = above; } @@ -726,6 +735,7 @@ MAP_OUT (reset_timeout); MAP_OUT (fixed_resettime); MAP_OUT (no_reset); + MAP_OUT (no_drop); MAP_OUT (difficulty); if (default_region) MAP_OUT2 (region, default_region->name); @@ -802,10 +812,7 @@ object *head = op->head_ (); if (op == head) - { - op->destroy_inv (false); - op->destroy (); - } + op->destroy (); else if (head->map != op->map) { LOG (llevDebug, "bad luck for object crossing map borders: %s", head->debug_desc ()); @@ -925,7 +932,7 @@ /* adjust overall chance below */ if (destroy && rndm (0, 1)) - op->destroy (); + op->destroy (true); } } @@ -983,10 +990,17 @@ { total_exp += op->stats.exp; - if (archetype *at = type_to_archetype (GENERATE_TYPE (op))) - total_exp += at->stats.exp * 8; + if (archetype *at = op->other_arch) + { + total_exp += at->stats.exp * 8; + monster_cnt++; + } - monster_cnt++; + for (object *inv = op->inv; inv; inv = inv->below) + { + total_exp += op->stats.exp * 8; + monster_cnt++; + } } } @@ -1035,6 +1049,7 @@ /* All clients need to get re-updated for the change */ update_all_map_los (this); + return 1; } @@ -1047,7 +1062,7 @@ void mapspace::update_ () { - object *tmp, *last = 0; + object *last = 0; uint8 flags = P_UPTODATE, light = 0, anywhere = 0; MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; @@ -1059,7 +1074,7 @@ object *&middle = faces_obj[1] = 0; object *&floor = faces_obj[2] = 0; - for (tmp = bot; tmp; last = tmp, tmp = tmp->above) + for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) { /* This could be made additive I guess (two lights better than * one). But if so, it shouldn't be a simple additive - 2 @@ -1095,6 +1110,7 @@ middle = tmp; anywhere = 1; } + /* Find the highest visible face around. If equal * visibilities, we still want the one nearer to the * top @@ -1153,7 +1169,7 @@ * 3) neither middle or top is set - need to set both. */ - for (tmp = last; tmp; tmp = tmp->below) + for (object *tmp = last; tmp; tmp = tmp->below) { /* Once we get to a floor, stop, since we already have a floor object */ if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) @@ -1566,9 +1582,6 @@ object * maptile::insert (object *op, int x, int y, object *originator, int flags) { - if (!op->flag [FLAG_REMOVED]) - op->remove (); - return insert_ob_in_map_at (op, this, originator, flags, x, y); }