Crash when reloading with charcoal directly from charcoal kiln #56479
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Bugfixes "Crash when reloading with charcoal directly from charcoal kiln"
Purpose of change
Fixes #56423
When reloading charcoal directly from a charcoal kiln it would leave a 0 quantity piece of charcoal in place and then would cause a crash when accessing that piece of charcoal. Also would place a pseudo item in the smoking rack and cause problems.
Steps to reproduce:
Describe the solution
map::use_charges() was accessing the furniture item first to get the charcoal. This would also return the pseudo item, which would get inserted into the smoker. Since no other call to this method was using the return value, this problem never manifested before.
The solution was just to swap the order of two sections of code to check the map before furniture. With the map being processed first it does not return the furniture pseudo item.
Describe alternatives you've considered
Testing
Tested with smoker and charcoal kiln. No issues noticed.
Additional context