diff --git a/src/item.cpp b/src/item.cpp index f09264b1ab37a..40c6981c8e90c 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -8371,13 +8371,6 @@ bool item::will_explode_in_fire() const return true; } - // Most containers do nothing to protect the contents from fire - if( !type->magazine || !type->magazine->protects_contents ) { - return has_item_with( [&]( const item & it ) { - return this != &it && it.will_explode_in_fire(); - } ); - } - return false; } @@ -8389,15 +8382,11 @@ bool item::detonate( const tripoint &p, std::vector &drops ) } else if( type->ammo && ( type->ammo->special_cookoff || type->ammo->cookoff ) ) { int charges_remaining = charges; const int rounds_exploded = rng( 1, charges_remaining / 2 ); - // Yank the exploding item off the map for the duration of the explosion - // so it doesn't blow itself up. - const islot_ammo &ammo_type = *type->ammo; - - if( ammo_type.special_cookoff ) { + if( type->ammo->special_cookoff ) { // If it has a special effect just trigger it. - apply_ammo_effects( p, ammo_type.ammo_effects ); + apply_ammo_effects( p, type->ammo->ammo_effects ); } - if( ammo_type.cookoff ) { + if( type->ammo->cookoff ) { // If ammo type can burn, then create an explosion proportional to quantity. explosion_handler::explosion( p, 3.0f * sqrtf( sqrtf( rounds_exploded / 25.0f ) ), 0.0f, false, 0 ); } @@ -8409,19 +8398,6 @@ bool item::detonate( const tripoint &p, std::vector &drops ) } return true; - } else if( !contents.empty() && ( !type->magazine || !type->magazine->protects_contents ) ) { - std::vector removed_items; - bool detonated = false; - for( item *it : contents.all_items_top() ) { - if( it->detonate( p, drops ) ) { - removed_items.push_back( it ); - detonated = true; - } - } - for( item *it : removed_items ) { - remove_item( *it ); - } - return detonated; } return false; diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 2725d40aad949..aa3d3ed2b9990 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -2275,7 +2275,6 @@ void Item_factory::check_and_create_magazine_pockets( itype &def ) for( const ammotype &amtype : def.magazine->type ) { mag_data.ammo_restriction.emplace( amtype, def.magazine->capacity ); } - mag_data.fire_protection = def.magazine->protects_contents; } if( def.gun ) { for( const ammotype &amtype : def.gun->ammo ) { diff --git a/src/itype.h b/src/itype.h index 523fbff460f8f..7799f2b3b3132 100644 --- a/src/itype.h +++ b/src/itype.h @@ -649,9 +649,6 @@ struct islot_magazine { /** For ammo belts one linkage (of given type) is dropped for each unit of ammo consumed */ cata::optional linkage; - - /** If false, ammo will cook off if this mag is affected by fire */ - bool protects_contents = false; }; struct islot_battery { diff --git a/src/map_field.cpp b/src/map_field.cpp index caf584bd34645..258098502faf9 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -519,17 +519,17 @@ bool map::process_fields_in_submap( submap *const current_submap, if( !is_sealed && map_tile.get_item_count() > 0 ) { map_stack items_here = i_at( p ); std::vector new_content; - for( auto explosive = items_here.begin(); explosive != items_here.end(); ) { - if( explosive->will_explode_in_fire() ) { + for( auto it = items_here.begin(); it != items_here.end(); ) { + if( it->will_explode_in_fire() ) { // We need to make a copy because the iterator validity is not predictable - item copy = *explosive; - explosive = items_here.erase( explosive ); + item copy = *it; + it = items_here.erase( it ); if( copy.detonate( p, new_content ) ) { // Need to restart, iterators may not be valid - explosive = items_here.begin(); + it = items_here.begin(); } } else { - ++explosive; + ++it; } }