summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-18 18:55:25 +0000
committerrubidium <rubidium@openttd.org>2007-09-18 18:55:25 +0000
commit7f721d31c2dd21fe9b5740cf9cabff269134757e (patch)
tree48210974aec1c6bf344c8746a142e5f252503472 /src/newgrf_industries.cpp
parent87f62c7109289814899fd146f4b7b9f78cd2a7cb (diff)
downloadopenttd-7f721d31c2dd21fe9b5740cf9cabff269134757e.tar.xz
(svn r11126) -Fix: the algorithm to determine the closest water/land was flawed.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index ad0fdc2cb..aaea06dc8 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -48,6 +48,7 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
for (t = 0; t < MapSize(); t++) {
if (IsTileType(t, MP_WATER) == water) break;
}
+ if (t == MapSize() && !water) return 0x200;
best_dist = DistanceManhattan(tile, t);
for (; t < MapSize(); t++) {
@@ -72,7 +73,7 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
}
}
- return best_dist;
+ return min(best_dist, water ? 0x7F : 0x1FF);
}
/** Make an analysis of a tile and check for its belonging to the same