CleverRaven/Cataclysm-DDA — pull request #6243 by BevapDin (2014-02-21 20:10:47+00:00)
Title: Fix turret activation use of wrong ammo

Activating an inactive turret and its ammo consumption

Have an inactive turret, some 9mm +P+ (or any other of type 9mm, but no simple 9mm at all!) in inventory.
Apply the turret somewhere:
```
Debugmsg: Tried to reduce charges but could not find item
```
Deactivating the turret gives normal 9mm ammo back, as many as one had when activating it: activating it with 100 x 9mm +P+ and 200 x 9mm FMJ in inventory, deactivating gives back 300 x 9mm.

The iuse function uses `inventory::charges_of("9mm")` to determine how much (how many?) ammo one has and later uses that value to `inventory::reduce_charges`. But `reduce_charges` operates on a single stack only (the first stack if items with the id 9mm in this case, not items of that ammo type!).

`inventory::charges_of` looks into guns and counts their ammo. It also counts stacks of ammo as long as those stacks are of the the same ammo type (e.g. 9mm +P+ when the requested type is 9mm).

Note: There should never be an ammo type with the same id as an item.