--- deliantra/server/common/los.C 2008/12/21 21:20:35 1.44 +++ deliantra/server/common/los.C 2008/12/23 00:39:48 1.46 @@ -270,11 +270,13 @@ /* 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 + 1][MAX_DARKNESS * 3 / 2 + 1]; static struct los_init { los_init () { + /* for lights */ for (int radius = -MAX_LIGHT_RADIUS; radius <= MAX_LIGHT_RADIUS; ++radius) for (int distance = 0; distance <= MAX_LIGHT_RADIUS * 3 / 2; ++distance) { @@ -288,6 +290,13 @@ ? min (3, intensity) : LOS_MAX - intensity; } + + /* for general vision */ + for (int radius = 0; radius <= MAX_DARKNESS; ++radius) + for (int distance = 0; distance <= MAX_DARKNESS * 3 / 2; ++distance) + { + vision_atten [radius][distance] = distance <= radius ? 3 : 4; + } } } los_init; @@ -401,9 +410,9 @@ /* grant some vision to the player, based on the darklevel */ { - int light = clamp (MAX_DARKNESS - darklevel, 0, MAX_LIGHT_RADIUS); + int light = clamp (MAX_DARKNESS - darklevel, 0, MAX_DARKNESS); - apply_light (op, 0, 0, light, light_atten [light + MAX_LIGHT_RADIUS]); + apply_light (op, 0, 0, light, vision_atten [light]); } } @@ -438,7 +447,7 @@ static void blinded_sight (object *op) { - op->contr->los[LOS_X0][LOS_Y0] = 3; + op->contr->los[LOS_X0][LOS_Y0] = 1; } /* @@ -483,9 +492,8 @@ void update_all_map_los (maptile *map) { - for_all_players (pl) - if (pl->ob && pl->ob->map == map) - pl->do_los = 1; + for_all_players_on_map (pl, map) + pl->do_los = 1; } /* @@ -503,6 +511,8 @@ void update_all_los (const maptile *map, int x, int y) { + map->at (x, y).invalidate (); + for_all_players (pl) { /* Player should not have a null map, but do this