1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-04 11:02:34 +01:00

Fix: Two lighthouse spawn issues (#14785)

* Fix: Lighthouses need sea to generate, not rivers

* Fix: Don't spawn lighthouses close together
This commit is contained in:
Tyler Trahan
2025-11-17 07:55:23 -05:00
committed by GitHub
parent 7398d2e290
commit e8d49ebfe6

View File

@@ -769,11 +769,14 @@ static bool TryBuildLightHouse()
}
/* Only build lighthouses at tiles where the border is sea. */
if (!IsTileType(tile, MP_WATER)) return false;
if (!IsTileType(tile, MP_WATER) || GetWaterClass(tile) != WATER_CLASS_SEA) return false;
for (int j = 0; j < 19; j++) {
int h;
if (IsTileType(tile, MP_CLEAR) && IsTileFlat(tile, &h) && h <= 2 && !IsBridgeAbove(tile)) {
for (auto t : SpiralTileSequence(tile, 9)) {
if (IsObjectTypeTile(t, OBJECT_LIGHTHOUSE)) return false;
}
BuildObject(OBJECT_LIGHTHOUSE, tile);
assert(tile < Map::Size());
return true;