mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r14415) -Fix (r10074): void tiles could be the nearest 'land' for water industries
This commit is contained in:
parent
e7829c1a57
commit
c631c26a9f
@ -52,7 +52,7 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
|
|||||||
TileIndex t;
|
TileIndex t;
|
||||||
int best_dist;
|
int best_dist;
|
||||||
for (t = 0; t < MapSize(); t++) {
|
for (t = 0; t < MapSize(); t++) {
|
||||||
if (IsTileType(t, MP_WATER) == water) break;
|
if (!IsTileType(t, MP_VOID) && IsTileType(t, MP_WATER) == water) break;
|
||||||
}
|
}
|
||||||
if (t == MapSize() && !water) return 0x200;
|
if (t == MapSize() && !water) return 0x200;
|
||||||
best_dist = DistanceManhattan(tile, t);
|
best_dist = DistanceManhattan(tile, t);
|
||||||
@ -60,7 +60,7 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
|
|||||||
for (; t < MapSize(); t++) {
|
for (; t < MapSize(); t++) {
|
||||||
int dist = DistanceManhattan(tile, t);
|
int dist = DistanceManhattan(tile, t);
|
||||||
if (dist < best_dist) {
|
if (dist < best_dist) {
|
||||||
if (IsTileType(t, MP_WATER) == water) best_dist = dist;
|
if (!IsTileType(t, MP_VOID) && IsTileType(t, MP_WATER) == water) best_dist = dist;
|
||||||
} else {
|
} else {
|
||||||
/* When the Y distance between the current row and the 'source' tile
|
/* When the Y distance between the current row and the 'source' tile
|
||||||
* is larger than the best distance, we've found the best distance */
|
* is larger than the best distance, we've found the best distance */
|
||||||
|
Loading…
Reference in New Issue
Block a user