--- deliantra/server/common/los.C 2006/12/23 13:56:25 1.11 +++ deliantra/server/common/los.C 2006/12/25 11:25:49 1.12 @@ -509,7 +509,7 @@ /* update all_map_los is like update_all_los below, * but updates everyone on the map, no matter where they - * are. This generally should not be used, as a per + * are. This generally should not be used, as a per * specific map change doesn't make much sense when tiling * is considered (lowering darkness would certainly be a * strange effect if done on a tile map, as it makes @@ -522,11 +522,10 @@ update_all_map_los (maptile *map) { for_all_players (pl) - if (pl->ob->map == map) + if (pl->ob && pl->ob->map == map) pl->do_los = 1; } - /* * This function makes sure that update_los() will be called for all * players on the given map within the next frame. @@ -539,7 +538,6 @@ * * map is the map that changed, x and y are the coordinates. */ - void update_all_los (const maptile *map, int x, int y) { @@ -548,7 +546,7 @@ /* Player should not have a null map, but do this * check as a safety */ - if (!pl->ob->map) + if (!pl->ob || !pl->ob->map || !pl->ns) continue; /* Same map is simple case - see if pl is close enough. @@ -565,14 +563,14 @@ 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 * view. The tile_maps[] could be null, but in that * case it should never match the pl->ob->map, so * we want ever try to dereference any of the data in it. - */ - - /* The logic for 0 and 3 is to see how far the player is + * + * The logic for 0 and 3 is to see how far the player is * from the edge of the map (height/width) - pl->ob->(x,y) * and to add current position on this map - that gives a * distance.