CleverRaven/Cataclysm-DDA — pull request #8221 by BevapDin (2014-07-12 22:26:37+00:00)
Title: Prevent software from being eaten

Fixes #7233

`item::is_food` checks for the `bio_furnance` and whether the item is `item::flammable`. The null material has fire_resist = 0 and is therefor flammable. The software has only the null material and is therefor flammable and editable with the bio_furnance.

Items without any material should not count as flammable at all, because we don't actually know what they are made of. Could just be an unimplemented (but fire resistant) material.

`item::flammable` is only called by `item::is_food`. There is a similar function `map::flammable_items_at`, but that one use a completely different method: it checks the actual material *ident*. That's odd.

I also synchronized the checks in `item::is_food` and `player::consume`. One could eat gasoline and it would be handled as if one had eaten batteries (20 charges gasoline == 1 bionic power). The logic was: it's food (has bio_furnance and gasoline was flammable (no material)), but it's not a comestible, and it's ammo, it must be be batteries.

The same applies to wood arrows. They are flammable and therefor food for the bio_furnance. But they are also ammo and therefor handled as batteries. I added the same check that is done in `item::is_food` (bio_batteries & ammo type is "batteries").

And finally: there is no message when you activate a bionic but don't have enough power left. It just leaves the bionics window, that's a bit confusing (especially as any key that is not an invlt will also leave the window). So I added a popup about the missing power and the window stays open.

Btw. you can still eat the USB drive (with or without the software), but this will actually consume the USB drive item (and any software on it). Same as if you eat an empty USB drive (it's plastic and flammable). Aside from gasoline, lamp oil is another ammo that has no material.