CleverRaven/Cataclysm-DDA — pull request #5832 by BevapDin (2014-01-30 19:42:57+00:00)
Title: Fix turrets

fixes #5824

Moved the target-acquiring code from `monattack::smg` and `monattack::laser` and vehicle mounted turrets into a single function. This also enhances the vehicle turret code as it now emits a warning when the player is in the way and uses the iff code to detect if the player is in the way.

Moved `game::pl_sees` to the player class and combined it with `game::u_see` and `game::pl_sees` into functions of the player class.
This allows the fake npcs (used by the turret code) and real npcs to work properly for monsters that are kind of invisible (digging/submerged).
It also works well for npcs that have now (nearly) the same viewing capabilities as the player, including mutations/traits/bionics.

It still uses the `map::seen_cache` exclusively for the player, npcs use `map::sees`, which might yield different results.

`player::fire_gun` seems to had a bug:
```
g->pl_sees(&g->u, &z, dummy) ) {
```
This check for monster z to be visible to the player, but this might be called from a npc/fake npc, unrelated to the player.

Related: #5766 seems to be resolved (before this PR). I can't reproduce this, nor does the code indicate any separation between zombears/zombie dogs and other critters. I tested it with several creatures from the debug menu including zombears/dogs on a laser/normal turret.

- Currently hostile/friendly turrets do not target any hostile/friendly npcs. Is it planed to be changed with the creature rework? Npcs will attack hostile turrets.