Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unseal when items are removed but the pocket isn't emptied #72608

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

RenechCDDA
Copy link
Member

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

if( parent ) {
parent->contained_where( *e )->on_contents_changed();
parent->on_contents_changed();
}

Testing

2024-03-25.05-21-30.mp4

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Mar 25, 2024
@RenechCDDA RenechCDDA force-pushed the unsealed_evil_in_a_can branch from 9679711 to 6089bbf Compare March 28, 2024 20:59
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 29, 2024
@Maleclypse Maleclypse merged commit f3c9576 into CleverRaven:master Mar 30, 2024
26 checks passed
@RenechCDDA RenechCDDA deleted the unsealed_evil_in_a_can branch March 30, 2024 11:10
@Procyonae Procyonae added the 0.H Backport PR to backport to the 0.H stable release canddiate label May 20, 2024
Procyonae pushed a commit to Procyonae/Cataclysm-DDA that referenced this pull request May 24, 2024
@Procyonae Procyonae mentioned this pull request May 24, 2024
kevingranade pushed a commit that referenced this pull request May 26, 2024
@Procyonae Procyonae added 0.H Backported and removed 0.H Backport PR to backport to the 0.H stable release canddiate labels May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.H Backported astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sealed can remains sealed after using contents in recipe
3 participants