Fix resource requirements when washing items with charges #35873
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
SUMMARY: Bugfixes "Fix resource requirements when washing items with charges"
Purpose of change
Fixes #32800
Closes #32824
Describe the solution
Volume calculation was doing
item.volume() * num_items
, which would work ifitem.volume()
always retrieved the volume of a single item/charge, but for items with charges, it retrieves the volume of the entire stack.Simply dividing by the number of charges for items counted by charges did the trick.
Describe alternatives you've considered
Leaving a review for #32824 so that the author could correct his solution. Decided fixing it myself would take less effort, as he didn't seem very amenable, having argued with long-time contributors over several points (at least one of which he was objectively wrong about) and then disappeared without fixing his incorrect solution.
Testing
Spawn a clothing item and an equal volume of thread, both with the
FILTHY
flag. Also soap, water, and a washing kit. Check that they both use the same amount of resources to wash.Additional context