CleverRaven/Cataclysm-DDA — pull request #7976 by BevapDin (2014-06-15 14:53:10+00:00)
Title: Only let attacks bounce to monsters when there is a clear path of sight

I got into the infinite loop from http://smf.cataclysmdda.com/index.php?topic=6820.0

Creature::projectile_attack moves along the trajectory from source (the monster the lighting bounces off) to the target. But this is stopped when the lightning hits a furniture with move_cost=0 (in my case a bookcase).

The loop calls `map::shoot` on each square that has no monster on it. This call can set `dam` to 0 when it has hit a solid furniture (like a bookcase, move_cost=0, see map.cpp:2028) and when `dam` is 0, the loop is canceled.

Therefor the chain lightning does never reach the targeted monster, and that monster does never get the "bounced" effect and therefor remains a valid target for bouncing.

The next thing is, when the trajectory ends on a solid square (move_cost==0), `Creature::projectile_attack` uses the previous square for finding the next target instead (px, yp).

So this happens here:
```
@ 1f2
```
Monster '1' is targeted, it bounces to monster '2', but the trajectory from '1 to '2' goes over the bookcase 'f'. The shoot is stopped there, but the code searches for a monster around the location of '1' (not around the location of 'f'), and finds the monster '2' again and the same starts all over.

This PR adds a check for a line of sight to the next monster.