--- deliantra/server/common/los.C 2008/12/26 10:36:42 1.52 +++ deliantra/server/common/los.C 2009/01/06 19:17:06 1.55 @@ -122,7 +122,7 @@ // now reset the los area and also add blocked flags // which supposedly is faster than doing it inside the // spiral path algorithm below, except when very little - // area is visible, in which case it is slower, evening + // area is visible, in which case it is slower. which evens // out los calculation times between large and small los maps. // apply_lights also iterates over this area, maybe these // two passes could be combined somehow. @@ -270,21 +270,6 @@ } } -/* returns true if op carries one or more lights - * This is a trivial function now days, but it used to - * be a bit longer. Probably better for callers to just - * check the op->glow_radius instead of calling this. - */ -int -has_carried_lights (const object *op) -{ - /* op may glow! */ - if (op->glow_radius > 0) - return 1; - - return 0; -} - /* radius, distance => lightness adjust */ static sint8 light_atten[MAX_LIGHT_RADIUS * 2 + 1][MAX_LIGHT_RADIUS * 3 / 2 + 1]; static sint8 vision_atten[MAX_DARKNESS + SEE_IN_DARK_RADIUS + 1][(MAX_DARKNESS + SEE_IN_DARK_RADIUS) * 3 / 2 + 1]; @@ -504,6 +489,10 @@ void update_all_los (const maptile *map, int x, int y) { + // no need to do anything if we don't have darkness + if (map->darklevel () <= 0) + return; + map->at (x, y).invalidate (); for_all_players (pl) @@ -524,10 +513,8 @@ * some. */ if (pl->ob->map == map) - { - if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) - pl->do_los = 1; - } + if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) + pl->do_los = 1; /* Now we check to see if player is on adjacent * maps to the one that changed and also within