mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r11126) -Fix: the algorithm to determine the closest water/land was flawed.
This commit is contained in:
parent
752eb0e8f5
commit
3f2925a105
@ -48,6 +48,7 @@ static uint GetClosestWaterDistance(TileIndex tile, bool water)
|
|||||||
for (t = 0; t < MapSize(); t++) {
|
for (t = 0; t < MapSize(); t++) {
|
||||||
if (IsTileType(t, MP_WATER) == water) break;
|
if (IsTileType(t, MP_WATER) == water) break;
|
||||||
}
|
}
|
||||||
|
if (t == MapSize() && !water) return 0x200;
|
||||||
best_dist = DistanceManhattan(tile, t);
|
best_dist = DistanceManhattan(tile, t);
|
||||||
|
|
||||||
for (; t < MapSize(); 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
|
/** Make an analysis of a tile and check for its belonging to the same
|
||||||
|
Loading…
Reference in New Issue
Block a user