Unseal when items are removed but the pocket isn't emptied #72608
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 "Crafting will unseal containers when contents are removed"
Purpose of change
item::on_contents_changed() only unseals when the pockets are emptied.
Describe the solution
Specifically track the item we're taking out, making sure to unseal the specific pocket containing that item, regardless if it empties the pocket. (It is at least mod-wise possible for items to have multiple pockets with independent sealed status and/or containing different items)
Describe alternatives you've considered
item::use_charges has an alternative implementation(below), but it's buried in a lambda.
Cataclysm-DDA/src/item.cpp
Lines 12238 to 12241 in 74771e1
Testing
2024-03-25.05-21-30.mp4
Additional context