From d9c55606116b45ddc464044f16cbc724c50ef793 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 6 Nov 2018 13:00:44 +0100 Subject: do not fail on removing second to last tile from a station --- src/map.cpp | 1 + src/station.cpp | 4 ++-- 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); -- cgit v1.2.3-70-g09d2