From 3a37053aac4aa29b653aea7c303f69f367a71f6c Mon Sep 17 00:00:00 2001 From: Estelle Linkpy Reid Date: Sat, 2 Jul 2022 14:50:25 +0200 Subject: [PATCH] Make sure the tile data clears its `terrain` field when said terrain is removed from the tileset. --- scene/resources/tile_set.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 13b671e5629..1e961e870c4 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -4924,6 +4924,10 @@ void TileData::move_terrain(int p_terrain_set, int p_from_index, int p_to_pos) { void TileData::remove_terrain(int p_terrain_set, int p_index) { if (terrain_set == p_terrain_set) { + if (terrain == p_index) { + terrain = -1; + } + for (int i = 0; i < 16; i++) { if (terrain_peering_bits[i] == p_index) { terrain_peering_bits[i] = -1;