diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-16 09:18:11 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-16 09:18:11 +0200 |
commit | ed81c93be75b41a76e4add2ba5066d24716bfbce (patch) | |
tree | 09ba91a19680c79850f43fe848858ba7dc708300 | |
parent | 3d1e135bc7831a8f9987596f918dc8f344f17be0 (diff) | |
parent | 7aa90d16675ce195a5e3932032717231e511c8b7 (diff) | |
download | redot-engine-ed81c93be75b41a76e4add2ba5066d24716bfbce.tar.gz |
Merge pull request #80658 from Sch1nken/tilemap-erase-scenes
TileMap: Check for possible scenes to be erased
-rw-r--r-- | scene/2d/tile_map.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 1836cc20b6..09effe6596 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1839,6 +1839,17 @@ void TileMapLayer::set_cell(const Vector2i &p_coords, int p_source_id, const Vec ERR_FAIL_COND(!Q); TileMapQuadrant &q = Q->value; + // Find node in scenes and remove it. + HashMap<Vector2i, String>::Iterator entry = q.scenes.find(pk); + if (entry != q.scenes.end()) { + String scene_name = entry->value; + Node *scene = tile_map_node->get_node_or_null(scene_name); + if (scene) { + scene->queue_free(); + instantiated_scenes.erase(Vector2i(pk.x, pk.y)); + } + } + q.cells.erase(pk); // Remove or make the quadrant dirty. |