Change: Allow bridges over docks. (#14594)
This commit is contained in:
@@ -5267,6 +5267,7 @@ STR_ERROR_BRIDGE_TOO_LONG :{WHITE}... brid
|
||||
STR_ERROR_BRIDGE_THROUGH_MAP_BORDER :{WHITE}Bridge would end out of the map
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_STATION :{WHITE}Bridge is too low for station
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_ROADSTOP :{WHITE}Bridge is too low for road stop
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_DOCK :{WHITE}Bridge is too low for dock
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_BUOY :{WHITE}Bridge is too low for buoy
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_RAIL_WAYPOINT :{WHITE}Bridge is too low for rail waypoint
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_ROAD_WAYPOINT :{WHITE}Bridge is too low for road waypoint
|
||||
|
||||
@@ -410,6 +410,8 @@ enum SaveLoadVersion : uint16_t {
|
||||
SLV_TOWN_SUPPLY_HISTORY, ///< 358 PR#14461 Town supply history.
|
||||
SLV_STATIONS_UNDER_BRIDGES, ///< 359 PR#14477 Allow stations under bridges.
|
||||
|
||||
SLV_DOCKS_UNDER_BRIDGES, ///< 360 PR#14594 Allow docks under bridges.
|
||||
|
||||
SL_MAX_VERSION, ///< Highest possible saveload version
|
||||
};
|
||||
|
||||
|
||||
@@ -867,7 +867,7 @@ static StringID GetBridgeTooLowMessageForStationType(StationType type)
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_ROADSTOP, // Truck
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_ROADSTOP, // Bus
|
||||
INVALID_STRING_ID, // Oilrig
|
||||
INVALID_STRING_ID, // Dock
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_DOCK, // Dock
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_BUOY, // Buoy
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_RAIL_WAYPOINT, // RailWaypoint
|
||||
STR_ERROR_BRIDGE_TOO_LOW_FOR_ROAD_WAYPOINT, // RoadWaypoint
|
||||
@@ -943,6 +943,21 @@ CommandCost IsRoadStationBridgeAboveOk(TileIndex tile, const RoadStopSpec *spec,
|
||||
return IsStationBridgeAboveOk(tile, bridgeable_info, type, layout, GetBridgeHeight(rampsouth), STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a dock can be built below a bridge.
|
||||
* @param tile Tile to test.
|
||||
* @param layout Layout piece of station to test.
|
||||
* @return Command result.
|
||||
*/
|
||||
static CommandCost IsDockBridgeAboveOk(TileIndex tile, StationGfx layout)
|
||||
{
|
||||
if (!IsBridgeAbove(tile)) return CommandCost();
|
||||
|
||||
TileIndex rampsouth = GetSouthernBridgeEnd(tile);
|
||||
auto bridgeable_info = GetStationBridgeableTileInfo(StationType::Dock);
|
||||
return IsStationBridgeAboveOk(tile, bridgeable_info, StationType::Dock, layout, 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.
|
||||
@@ -2878,7 +2893,8 @@ CommandCost CmdBuildDock(DoCommandFlags flags, TileIndex tile, StationID station
|
||||
CommandCost ret = CheckIfAuthorityAllowsNewStation(tile, flags);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
if (IsBridgeAbove(tile)) return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
ret = IsDockBridgeAboveOk(tile, to_underlying(direction));
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
@@ -2891,7 +2907,8 @@ CommandCost CmdBuildDock(DoCommandFlags flags, TileIndex tile, StationID station
|
||||
return CommandCost(STR_ERROR_SITE_UNSUITABLE);
|
||||
}
|
||||
|
||||
if (IsBridgeAbove(tile_cur)) return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||
ret = IsDockBridgeAboveOk(tile_cur, GFX_DOCK_BASE_WATER_PART + to_underlying(DiagDirToAxis(direction)));
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
/* Get the water class of the water tile before it is cleared.*/
|
||||
WaterClass wc = GetWaterClass(tile_cur);
|
||||
|
||||
@@ -919,6 +919,15 @@ static const BridgeableTileInfo _station_bridgeable_info_waypoint[] = {
|
||||
{2, {BridgePillarFlag::EdgeNW, BridgePillarFlag::EdgeSE}}, // Y-axis waypoint.
|
||||
};
|
||||
|
||||
static const BridgeableTileInfo _station_bridgeable_info_dock[] = {
|
||||
{2, {}}, // Northeast slope.
|
||||
{2, {}}, // Southeast slope.
|
||||
{2, {}}, // Southwest slope.
|
||||
{2, {}}, // Northwest slope.
|
||||
{3, {}}, // X-axis part on water.
|
||||
{3, {}}, // Y-axis part on water.
|
||||
};
|
||||
|
||||
static const BridgeableTileInfo _station_bridgeable_info_buoy[] = {
|
||||
{1, {}},
|
||||
};
|
||||
@@ -947,7 +956,7 @@ static const std::array<std::span<const BridgeableTileInfo>, to_underlying(Stati
|
||||
_station_bridgeable_info_roadstop, // Truck
|
||||
_station_bridgeable_info_roadstop, // Bus
|
||||
{}, // Oilrig
|
||||
{}, // Dock
|
||||
_station_bridgeable_info_dock, // Dock
|
||||
_station_bridgeable_info_buoy, // Buoy
|
||||
_station_bridgeable_info_waypoint, // RailWaypoint
|
||||
_station_bridgeable_info_road_waypoint, // RoadWaypoint
|
||||
|
||||
Reference in New Issue
Block a user