CleverRaven/Cataclysm-DDA — pull request #5301 by ianestrachan (2013-12-31 00:00:22+00:00)
Title: Remove items directly instead of by position.

Fixes #5267.

Basically, because placing a turret could consume a full stack of ammunition, the removal of that stack would cause a position shift in the player's inventory, so the position where the turret was no longer referenced the turret. It would attempt to remove the null item, which of course does nothing.

Since we already had a pointer directly to the item, it now removes that item directly instead of using the possibly-stale position, which should prevent any future bugs of this type resulting from items consuming other items when used.