From b9912ab58c61fdfbee3665e745470eaea5656f76 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Sun, 26 May 2024 22:13:50 +0100 Subject: [PATCH] Merge pull request #72608 from RenechCDDA/unsealed_evil_in_a_can (#74047) Co-authored-by: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> --- src/item.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/item.cpp b/src/item.cpp index 375ef3048eb0c..4a4bb13985a39 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -12017,6 +12017,13 @@ bool item::use_amount( const itype_id &it, int &quantity, std::list &used, } for( item *removed : removed_items ) { + // Handle cases where items are removed but the pocket isn't emptied + item *parent = this->find_parent( *removed ); + for( item_pocket *pocket : parent->get_all_standard_pockets() ) { + if( pocket->has_item( *removed ) ) { + pocket->unseal(); + } + } this->remove_item( *removed ); }