summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2020-01-05 14:49:11 +0000
committerCharles Pigott <charlespigott@googlemail.com>2020-01-05 20:44:07 +0000
commit12380fc1bb952d5b8a368249082cd85291a78e82 (patch)
treeae73bc155a6ca28da9d53cd6d1a08971e335413d /src
parent12f4602f57f0f7461c83eaa21209587ad9643af2 (diff)
downloadopenttd-12380fc1bb952d5b8a368249082cd85291a78e82.tar.xz
Fix: Assertion failure when post road-works cleanup removes all road pieces
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index ace8edff7..5a9efb856 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -1955,6 +1955,12 @@ static void TileLoop_Road(TileIndex tile)
if (old_rb != new_rb) {
RemoveRoad(tile, DC_EXEC | DC_AUTO | DC_NO_WATER, (old_rb ^ new_rb), RTT_ROAD, true);
+
+ /* If new_rb is 0, there are now no road pieces left and the tile is no longer a road tile */
+ if (new_rb == 0) {
+ MarkTileDirtyByTile(tile);
+ return;
+ }
}
}