There's now a spell-specific _lightning_los which may require some fine-tuning – I'm not quite sure of the intention of the original check.
J4JZLGO4NZHHSJ6EEUMYQVUJRU5XUQ464ZRLRRVCOGE7RS5IZFJAC
AL7EYY4HB7JNEFGDB6NVVHCVVUYYKUJKC4UFH4T7XUT3P5NT4NAAC
SKDYI6JCFWV2UP7PL22YHOAHU6ZC6Y3BKACW2C6KSEDFESSP34FQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
T47W6FG7GCHCFEWR6MPVLDYVYG7Y4U4F3VY3FXKJNXV5R7HH544QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
HAHX6NKIVDCUYFBNF2SPRFGIPTWMJVCQNASKJE5GMFQ63KTDNJAAC
TGJZXTUIAKCFZQJ54ZQEBGFBVZSJCAX6AWDRSH3TP7UJRLGUM5SAC
2EBEWIV4YHXXAFR4GG2GMZJ2K77NK762HNQ77CZLHI3LDVGX7RJAC
O7S3ILRELHICJXXTDGMF7KPPZWYHPYCNDPV2I77FZXXH4I454B4QC
7YUGK5Q64KG5O7GJGTUBRRLHAHBCJ5YOE23YUPT6UBKUSB67CYAQC
TZNURHCLTLE3A55EPNU66BU6NX7LOBA7EFG4NAJJBUKZLOAEFU4AC
/**
* Checks whether target is in sight of source.
*
* Only used from cast_chain_lightning currently.
* XXX: Move to los.cc; integrate with other LOS code.
*/
bool check_line_of_sight(const coord_def& source, const coord_def& target)
{
const int dist = grid_distance(source, target);
// Can always see one square away.
if (dist <= 1)
return (true);
// Currently we limit the range to 8.
if (dist > MONSTER_LOS_RANGE)
return (false);
// Note that we are guaranteed to be within the player LOS range,
// so fallback is unnecessary.
return exists_ray(source, target);
}