diff --git a/src/item.cpp b/src/item.cpp index e5360505264b9..f28c2e97c1619 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1278,6 +1278,7 @@ void item::update_modified_pockets() std::optional mag_or_mag_well; std::vector container_pockets; + // Prevent cleanup of pockets belonging to the item base type for( const pocket_data &pocket : type->pockets ) { if( pocket.type == pocket_type::CONTAINER ) { container_pockets.push_back( &pocket ); @@ -1287,6 +1288,13 @@ void item::update_modified_pockets() } } + // Prevent cleanup of added modular pockets + for( const item *it : contents.get_added_pockets() ) { + for( const pocket_data &pocket : it->type->pockets ) { + container_pockets.push_back( &pocket ); + } + } + for( const item *mod : mods() ) { if( mod->type->mod ) { for( const pocket_data &pocket : mod->type->mod->add_pockets ) {