From fd17426f3724f52603c3e1148835b7833049c0bc Mon Sep 17 00:00:00 2001 From: Loobinex Date: Sat, 24 Aug 2024 23:20:04 +0200 Subject: [PATCH] Heart rooms placed during gameplay have functional containers (#3419) --- src/map_blocks.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/map_blocks.c b/src/map_blocks.c index e9ca0c026c..70655efaa6 100644 --- a/src/map_blocks.c +++ b/src/map_blocks.c @@ -1018,12 +1018,21 @@ void place_slab_object(SlabCodedCoords slb_num, MapSubtlCoord stl_x,MapSubtlCoor } if ( !needs_object ) continue; - } - struct Thing *objtng; - objtng = create_object(&pos, tngmodel, plyr_idx, slb_num); - if (thing_is_invalid(objtng)) { - ERRORLOG("Cannot create object type %d", tngmodel); - continue; + } + struct Thing *objtng; + objtng = create_object(&pos, tngmodel, plyr_idx, slb_num); + if (thing_is_invalid(objtng)) + { + ERRORLOG("Cannot create object type %d", tngmodel); + continue; + } + if (thing_is_dungeon_heart(objtng)) + { + struct Dungeon* dungeon = get_dungeon(objtng->owner); + if (dungeon->backup_heart_idx == 0) + { + dungeon->backup_heart_idx = objtng->index; + } } } else if (sobj->class_id == TCls_EffectGen)