CleverRaven/Cataclysm-DDA — pull request #5495 by BevapDin (2014-01-10 18:43:33+00:00)
Title: Fix some bug with smokebombs, teargas canister and mininukes

Smokebombs, teargas canister and mininukes create certain gas-fields on the map.

To do this the iuse-function iterate over the squares around the item and check if a gas field can/should be placed there.
This check includes a line of sight from the item to the possible position of the new field. But new fields obstruct the line of sight.

As soon as all eight squares around the item have a field on them, there is no line of sight from the item to anywhere and no new field gets created.

A mininuke in an open area will therefor always produce this pattern of gas fields:
```
88888
88888
88888
888*8
88888
888
888
```
The free area to the southeast and east is checked last and does not have a line of sight to the mininuke as the thick radioactive gas blocks the view (at least `map::sees` thinks so).

Smoke bomb/teargas canister creates this:
```
8888
8888
88*8
8888
88
```
None of these functions creates a field on the same square as the item itself, as apparently `map::sees(x,y, x,y)` returns false for same reason. This PR corrects this.

Another thing: smoke bomb/teargas canister create gas through closed windows because the code only checks for a line of *sight*. This PR corrects this, too.

Another thing: active teargas grenade are supposed to revert back to an empty canister, but they actually don't: the iuse-function changes the item type back to "canister_empty", but the code handling active items always destroys the item - except when the json data says it reverts to something. This has been fixed, too.

Question for the devs:
In `iuse::mininuke_act` the loop tries to create fields in a 9x9 area around the mininuke (-4 <= dx <= +4). The 5. parameter (range) to `map::sees` is set to 3, which makes `map::sees` return false if the distance is greater than that range. Therefor fields will only be created in a 7x7 area (-3 <= dx <= +3).
What is the correct range? (this PR assumes range 4)

Another thing is `map::sees` uses `map::trans` for transparency checks, but the player uses the transparency_cache build by `map::build_transparency_cache`.

Both functions handle fields a bit different:
- `map::build_transparency_cache` has hard coded checks for the field type and density and reduces the transparency for thick radioactive gas (but not to 0).
- `map::trans` thinks of thick radioactive gas as completely opaque.