1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 11:22:45 +01:00

Fix #14982: Can't place buoys under bridges. (#15007)

Bridges can be built over buoys but not the other way around.
This commit is contained in:
Peter Nelson
2026-01-01 16:31:08 +00:00
committed by GitHub
parent f57c2cc56e
commit 27c5f9a5cd
2 changed files with 16 additions and 1 deletions

View File

@@ -960,6 +960,20 @@ static CommandCost IsDockBridgeAboveOk(TileIndex tile, StationGfx layout)
return IsStationBridgeAboveOk(tile, bridgeable_info, StationType::Dock, layout, GetBridgeHeight(rampsouth), STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
}
/**
* Test if a buoy can be built below a bridge.
* @param tile Tile to test.
* @return Command result.
*/
CommandCost IsBuoyBridgeAboveOk(TileIndex tile)
{
if (!IsBridgeAbove(tile)) return CommandCost();
TileIndex rampsouth = GetSouthernBridgeEnd(tile);
auto bridgeable_info = GetStationBridgeableTileInfo(StationType::Buoy);
return IsStationBridgeAboveOk(tile, bridgeable_info, StationType::Buoy, 0, GetBridgeHeight(rampsouth), STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
}
/**
* Checks if a rail station can be built at the given tile.
* @param tile_cur Tile to check.

View File

@@ -187,6 +187,7 @@ extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID sta
extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta);
extern CommandCost CalculateRoadStopCost(TileArea tile_area, DoCommandFlags flags, bool is_drive_through, StationType station_type, const RoadStopSpec *roadstopspec, Axis axis, DiagDirection ddir, StationID *est, RoadType rt, Money unit_cost);
extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *spec, StationType type, StationGfx layout);
extern CommandCost IsBuoyBridgeAboveOk(TileIndex tile);
extern CommandCost RemoveRoadWaypointStop(TileIndex tile, DoCommandFlags flags, int replacement_spec_index);
@@ -474,7 +475,7 @@ CommandCost CmdBuildRoadWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
CommandCost CmdBuildBuoy(DoCommandFlags flags, TileIndex tile)
{
if (tile == 0 || !HasTileWaterGround(tile)) return CommandCost(STR_ERROR_SITE_UNSUITABLE);
if (IsBridgeAbove(tile)) return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
if (CommandCost ret = IsBuoyBridgeAboveOk(tile); ret.Failed()) return ret;
if (!IsTileFlat(tile)) return CommandCost(STR_ERROR_SITE_UNSUITABLE);