From f3e4798058f0a4a6591c6510c4e6ee3509a273b3 Mon Sep 17 00:00:00 2001 From: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Sun, 9 Jun 2024 07:33:42 +0100 Subject: [PATCH] Fucking hell Sort of works but non-count_by_charges harvest materials don't stack when spawning for some reason? --- src/map.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 42a8d3a151bb..df92ffdcdeac 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -7263,7 +7263,8 @@ void map::loadn( const tripoint &grid, const bool update_vehicles ) template void map::remove_rotten_items( Container &items, const tripoint &pnt, temperature_flag temperature ) { - items.remove_with( [this, &pnt, &temperature]( detached_ptr &&it ) { + std::vector corpses_handle; + items.remove_with( [this, &pnt, &temperature, &corpses_handle]( detached_ptr &&it ) { item &obj = *it; it = item::actualize_rot( std::move( it ), pnt, temperature, get_weather() ); // When !it, that means the item was removed from the world, ie: has rotted. @@ -7271,11 +7272,16 @@ void map::remove_rotten_items( Container &items, const tripoint &pnt, temperatur if( obj.is_comestible() ) { rotten_item_spawn( obj, pnt ); } else if( obj.is_corpse() ) { - handle_decayed_corpse( obj, pnt ); + corpses_handle.push_back( &obj ); } } return std::move( it ); } ); + + for( const item *corpse : corpses_handle ) { + handle_decayed_corpse( *corpse, pnt ); + } + } void map::handle_decayed_corpse( const item &it, const tripoint &pnt )