Bridges can be built over buoys but not the other way around.
This commit is contained in:
@@ -963,6 +963,20 @@ static CommandCost IsDockBridgeAboveOk(TileIndex tile, StationGfx layout)
|
|||||||
return IsStationBridgeAboveOk(tile, bridgeable_info, StationType::Dock, layout, GetBridgeHeight(rampsouth), STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
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.
|
* Checks if a rail station can be built at the given tile.
|
||||||
* @param tile_cur Tile to check.
|
* @param tile_cur Tile to check.
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID sta
|
|||||||
extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta);
|
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 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 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);
|
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)
|
CommandCost CmdBuildBuoy(DoCommandFlags flags, TileIndex tile)
|
||||||
{
|
{
|
||||||
if (tile == 0 || !HasTileWaterGround(tile)) return CommandCost(STR_ERROR_SITE_UNSUITABLE);
|
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);
|
if (!IsTileFlat(tile)) return CommandCost(STR_ERROR_SITE_UNSUITABLE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user