--- deliantra/server/common/map.C 2008/09/29 10:20:48 1.147 +++ deliantra/server/common/map.C 2008/12/23 06:58:23 1.153 @@ -27,6 +27,8 @@ #include "loader.h" #include "path.h" +sint8 maptile::outdoor_darkness; + /* This rolls up wall, blocks_magic, blocks_view, etc, all into * one function that just returns a P_.. value (see map.h) * it will also do map translation for tiled maps, returning @@ -353,8 +355,7 @@ else { f.parse_warn (format ("object %s out of range", op->debug_desc ())); - op->destroy_inv (false); // be explicit about dropping - op->destroy (true); + op->destroy (); } } @@ -715,10 +716,7 @@ unique = 1; if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) - { - op->destroy_inv (false); - op->destroy (true); - } + op->destroy (); op = above; } @@ -816,14 +814,11 @@ object *head = op->head_ (); if (op == head) - { - op->destroy_inv (false); - op->destroy (true); - } + op->destroy (); else if (head->map != op->map) { LOG (llevDebug, "bad luck for object crossing map borders: %s", head->debug_desc ()); - head->destroy (true); + head->destroy (); } } @@ -939,7 +934,7 @@ /* adjust overall chance below */ if (destroy && rndm (0, 1)) - op->destroy (true); + op->destroy (); } } @@ -972,10 +967,10 @@ * difficulty does not have a lot to do with character level, * but does have a lot to do with treasure on the map. * - * Difficulty can now be set by the map creature. If the value stored - * in the map is zero, then use this routine. Maps should really - * have a difficulty set than using this function - human calculation - * is much better than this functions guesswork. + * Difficulty can now be set by the map creator. If the value stored + * in the map is zero, then use this routine. Maps should really + * have a difficulty set rather than using this function - human calculation + * is much better than this function's guesswork. */ int maptile::estimate_difficulty () const @@ -1070,7 +1065,8 @@ mapspace::update_ () { object *last = 0; - uint8 flags = P_UPTODATE, light = 0, anywhere = 0; + 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; //object *middle = 0; @@ -1083,12 +1079,8 @@ 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 - * light bulbs do not illuminate twice as far as once since - * it is a dissapation factor that is cubed. - */ - light = max (light, tmp->glow_radius); + // Lights are additive, up to MAX_LIGHT_RADIUS, see los.C) + light += tmp->glow_radius; /* This call is needed in order to update objects the player * is standing in that have animations (ie, grass, fire, etc). @@ -1146,7 +1138,7 @@ if (QUERY_FLAG (tmp, FLAG_DAMNED)) flags |= P_NO_CLERIC; } - this->light = light; + this->light = min (light, MAX_LIGHT_RADIUS); this->flags_ = flags; this->move_block = move_block & ~move_allow; this->move_on = move_on; @@ -1637,17 +1629,16 @@ if (!sound) return; - for_all_players (pl) - if (pl->ob->map == this) - if (client *ns = pl->ns) - { - int dx = x - pl->ob->x; - int dy = y - pl->ob->y; + for_all_players_on_map (pl, this) + if (client *ns = pl->ns) + { + int dx = x - pl->ob->x; + int dy = y - pl->ob->y; - int distance = idistance (dx, dy); + int distance = idistance (dx, dy); - if (distance <= MAX_SOUND_DISTANCE) - ns->play_sound (sound, dx, dy); - } + if (distance <= MAX_SOUND_DISTANCE) + ns->play_sound (sound, dx, dy); + } }