forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Count charges in all nearby smoking racks to crafting inventory
Fixes an issue where only the charges from one nearby smoking rack would be counted to the crafting inventory, even if there were other smoking racks nearby that had sufficient charges to perform a selected crafting recipe. The issue before was: 1. Part of building crafting inventory calls `inventory::form_from_map` 2. `inventory::form_from_map` has the following checks for pseudo tools from furniture: ``` const furn_t &f = m.furn( p ).obj(); if( item *furn_item = provide_pseudo_item( f.crafting_pseudo_item ) ) { const itype *ammo = f.crafting_ammo_item_type(); ``` 3. `inventory::provide_pseudo_item` returns `nullptr` if the crafting inventory already has a tool of the same type: 4. So `inventory::form_from_map` would only get a pseudo tool back in `furn_item` for the first furniture that was examined. 5. The ammo amount being calculated in `inventory::form_from_map` would therefore only be for that furniture. This commit instead changes `inventory::provide_pseudo_item` so that if a pseudo tool is provided more than once, the second call will return the pseudo tool from the first call, instead of `nullptr` as before. This makes it possible for `inventory::form_from_map` to keep adding ammo (charcoal charges) to the same pseudo smoking rack as it builds up the crafting inventory. In effect, if there are two smoking racks with charges nearby, the crafting inventory will now still contain only one pseudo tool for smoking rack, but its ammo will be the sum of all nearby smoking racks' charges.
- Loading branch information
Showing
2 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters