CleverRaven/Cataclysm-DDA — pull request #9355 by BevapDin (2014-10-01 17:21:51+00:00)
Title: Fix the FTK-93 crash

Fixes #9343

This is caused by `item::weight` it assumes that all guns (FTK is one) have a valid `item::curammo` when they have at least one charge. The FTK is not loaded at all (and curammo is therefor null).

The problem is the "USE_UPS" of the FTK. IN `player::process_active_items`, charges from the UPS are added to the FTK (it only checks for the "USE_UPS" flag in the item). Now the FTK has charges, but curammo is still null.

`item::weight` adds the weight of the ammo to the weight of the gun itself, but curammo is still null, so it crashes.

Fixing `item::weight` won't help, this might also trigger a crash when firing the gun, generally charges != 0 and curammo == null don't go well.

The problem can be stated as: The tools use a flag "USE_UPS" with a different meaning than the guns do.

----

I removed the "USE_UPS" flag from guns, instead the amount of UPS charges required by them is implicitly given as integer (also removes the "USE_UPS20" and "USE_UPS40" flags). Now the

Conflicts with #9354 btw. There the USE_UPS flag is used in its old way.