summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index a0df59d8f..34a6f8975 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -38,62 +38,6 @@ IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id)
return _industry_mngr.GetID(GB(grf_type, 0, 6), grf_id);
}
-/**
- * Finds the distance for the closest tile with water/land given a tile
- * @param tile the tile to find the distance too
- * @param water whether to find water or land
- * @return distance to nearest water (max 0x7F) / land (max 0x1FF; 0x200 if there is no land)
- * @note FAILS when an industry should be seen as water
- */
-static uint GetClosestWaterDistance(TileIndex tile, bool water)
-{
- if (IsTileType(tile, MP_WATER) == water) return 0;
-
- uint max_dist = water ? 0x7F : 0x200;
-
- int x = TileX(tile);
- int y = TileY(tile);
-
- uint max_x = MapMaxX();
- uint max_y = MapMaxY();
- uint min_xy = _settings_game.construction.freeform_edges ? 1 : 0;
-
- /* go in a 'spiral' with increasing manhattan distance in each iteration */
- for (uint dist = 1; dist < max_dist; dist++) {
- /* next 'diameter' */
- y--;
-
- /* going counter-clockwise around this square */
- for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
- static const int8 ddx[DIAGDIR_END] = { -1, 1, 1, -1};
- static const int8 ddy[DIAGDIR_END] = { 1, 1, -1, -1};
-
- int dx = ddx[dir];
- int dy = ddy[dir];
-
- /* each side of this square has length 'dist' */
- for (uint a = 0; a < dist; a++) {
- /* MP_VOID tiles are not checked (interval is [min; max) for IsInsideMM())*/
- if (IsInsideMM(x, min_xy, max_x) && IsInsideMM(y, min_xy, max_y)) {
- TileIndex t = TileXY(x, y);
- if (IsTileType(t, MP_WATER) == water) return dist;
- }
- x += dx;
- y += dy;
- }
- }
- }
-
- if (!water) {
- /* no land found - is this a water-only map? */
- for (TileIndex t = 0; t < MapSize(); t++) {
- if (!IsTileType(t, MP_VOID) && !IsTileType(t, MP_WATER)) return 0x1FF;
- }
- }
-
- return max_dist;
-}
-
/** Make an analysis of a tile and check for its belonging to the same
* industry, and/or the same grf file
* @param tile TileIndex of the tile to query