CleverRaven/Cataclysm-DDA — pull request #9001 by BevapDin (2014-09-14 21:52:06+00:00)
Title: Fix the price calculation

Fixes the price calculation, fixes #8844.

For some reason the pseudo item used to represent cents had a price of 120.00 Dollar. This screws up the value calculation of the cash cards (which is price of the item as from json data + charges * price of the "ammo" of the item). The cash card has now a proper price (the card itself is worth 1 Dollar, plus the money that is represented on it).

Fixes the price calculation of tools with charges: It should not consider the maximal charges (tools without curammo can usually not be reloaded anyway), but the default charges. And of course it should divide by that value, not multiply, that caused the wrong price of lightstrips.

The price calculation was wrong for food, it should have divided by the default-stack size, not multiplied it (just like it did with ammo). This is corrected and uses the same logic as the volume calculation now. I used the code from the volume calculation as this is an established behavior and it's already used for ammo prices.

That means the price in the json files is the price for the default stack size (for items that are counted by charges). But maybe the price in the json data should be per single unit?

In contrast to that (and to the volume calculation), the weight value from the json is actually for the single unit (not for the default stack), it's a bit confusing. So any further options about that?

----

Btw. currently all 3 types of lightstrips have the same price, an active light strip uses value when its charges go down, but the dead lightstrip has the same value as a inactive lightstrip. It should probably be worth less as it has to be disabled and rebuild before if can be used again.