summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-06 13:00:44 +0100
committerErich Eckner <git@eckner.net>2018-11-16 19:11:47 +0100
commitd9c55606116b45ddc464044f16cbc724c50ef793 (patch)
treeca6b1b9aa15329f77a00747d44138241b8d4c896
parent0f0a351718807817c0638a128a7e886087d5ec1b (diff)
downloadopenttd-d9c55606116b45ddc464044f16cbc724c50ef793.tar.xz
do not fail on removing second to last tile from a station
-rw-r--r--src/map.cpp1
-rw-r--r--src/station.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index c7e4f5fbc..c00faa18c 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -275,6 +275,7 @@ bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, v
/* If tile test is not successful, get one tile up,
* ready for a test in first circle around center tile */
*tile = TileAddByDir(*tile, DIR_N);
+ if (size / 2 == 0) return false;
return CircularTileSearch(tile, size / 2, 1, 1, proc, user_data);
} else {
return CircularTileSearch(tile, size / 2, 0, 0, proc, user_data);
diff --git a/src/station.cpp b/src/station.cpp
index 1266de7f2..fac559e5f 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -366,8 +366,8 @@ void Station::RecomputeIndustriesNear()
/* Охватываем верхнюю территорию */
TileIndex start_tile = TopTile(this->xy);
uint max_radius = max(
- max(DistanceManhattan(start_tile, TileXY(riv.rect.left, riv.rect.top)), DistanceManhattan(start_tile, TileXY(riv.rect.left, riv.rect.bottom))),
- max(DistanceManhattan(start_tile, TileXY(riv.rect.right, riv.rect.top)), DistanceManhattan(start_tile, TileXY(riv.rect.right, riv.rect.bottom)))
+ max(DistanceManhattan(start_tile, TopTile(TileXY(riv.rect.left, riv.rect.top))), DistanceManhattan(start_tile, TopTile(TileXY(riv.rect.left, riv.rect.bottom)))),
+ max(DistanceManhattan(start_tile, TopTile(TileXY(riv.rect.right, riv.rect.top))), DistanceManhattan(start_tile, TopTile(TileXY(riv.rect.right, riv.rect.bottom))))
);
CircularTileSearch(&start_tile, 2 * max_radius + 1, &FindIndustryToDeliver, &riv);