--- deliantra/server/common/map.C 2009/11/06 13:03:34 1.168 +++ deliantra/server/common/map.C 2009/11/08 15:11:22 1.170 @@ -451,6 +451,7 @@ height = 16; timeout = 300; max_nrof = 1000; // 1000 items of anything + max_items = 25; max_volume = 2000000; // 2m³ } @@ -1032,6 +1033,8 @@ uint8 flags = P_UPTODATE, anywhere = 0; sint8 light = 0; MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; + uint64_t volume = 0; + uint32_t nrof = 0; //object *middle = 0; //object *top = 0; @@ -1043,6 +1046,8 @@ for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) { + ++nrof; + // Lights are additive, up to MAX_LIGHT_RADIUS, see los.C) light += tmp->glow_radius; @@ -1056,36 +1061,38 @@ */ if (!tmp->invisible) { - if ((tmp->type == PLAYER || QUERY_FLAG (tmp, FLAG_MONSTER))) + if (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER]) top = tmp; - else if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) - { - /* If we got a floor, that means middle and top were below it, - * so should not be visible, so we clear them. - */ - middle = 0; - top = 0; - floor = tmp; - } - /* Flag anywhere have high priority */ - else if (QUERY_FLAG (tmp, FLAG_SEE_ANYWHERE)) + else { - middle = tmp; - anywhere = 1; - } - - /* Find the highest visible face around. If equal - * visibilities, we still want the one nearer to the - * top - */ - else if (!middle || (::faces [tmp->face].visibility > ::faces [middle->face].visibility && !anywhere)) - middle = tmp; - } + if (tmp->flag [FLAG_IS_FLOOR]) + { + /* If we got a floor, that means middle and top were below it, + * so should not be visible, so we clear them. + */ + middle = 0; + top = 0; + floor = tmp; + } + else + { + if (!tmp->flag [FLAG_NO_PICK]) + volume += tmp->volume (); - if (tmp == tmp->above) - { - LOG (llevError, "Error in structure of map\n"); - exit (-1); + /* Flag anywhere have high priority */ + if (tmp->flag [FLAG_SEE_ANYWHERE]) + { + middle = tmp; + anywhere = 1; + } + /* Find the highest visible face around. If equal + * visibilities, we still want the one nearer to the + * top + */ + else if (!middle || (::faces [tmp->face].visibility > ::faces [middle->face].visibility && !anywhere)) + middle = tmp; + } + } } move_slow |= tmp->move_slow; @@ -1108,6 +1115,8 @@ this->move_on = move_on; this->move_off = move_off; this->move_slow = move_slow; + this->volume_ = volume / 1024; + this->nrof_ = min (65535, nrof); /* At this point, we have a floor face (if there is a floor), * and the floor is set - we are not going to touch it at @@ -1183,17 +1192,6 @@ #endif } -uint64 -mapspace::volume () const -{ - uint64 vol = 0; - - for (object *op = top; op && !op->flag [FLAG_NO_PICK]; op = op->below) - vol += op->volume (); - - return vol; -} - maptile * maptile::tile_available (int dir, bool load) { @@ -1588,7 +1586,7 @@ } // instead of crashing in the unlikely(?) case, try to return *something* - return archetype::find ("bug"); + return archetype::find (shstr_bug); } //-GPL