CleverRaven/Cataclysm-DDA — pull request #8812 by rluddy (2014-09-04 01:29:55+00:00)
Title: Fixes worn items with UPS conversion mod

They were previously super-broken. The iterator used auto rather than
auto&, so if you had any worn UPS-using items it would charge a copy
of the item rather than the item itself. Not only would your UPS
wearable flashlight not work, it would permanently drain any active
UPS.

Changed worn items to iterate the same way as inventory items. This
also means it now properly checks for the UPS running out (or even if
you have a UPS to begin with).

Test:
Spawn a wearable flashlight, UPS mod, and UPS.
Install mod in flashlight.
Wear flashlight. (Important, as this fix only matters for worn items.)
Turn on UPS.

Previously this would result in the UPS draining 1 charge per turn in
addition to its standby usage while the worn flashlight would never
charge. With this change it results in the flashlight draining the UPS
until it finishes charging, then the UPS only having its standby
usage.