Fix handling of custom bridge heads on steep slopes.

pull/16/head
Jonathan G Rennison 7 years ago
parent 3278051913
commit 57a5f08687

@ -731,7 +731,11 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if ((pieces & ~axial_pieces) && !_settings_game.construction.build_on_slopes) {
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}
if ((_invalid_tileh_slopes_road[0][tileh] & (pieces & ~entrance_piece)) != ROAD_NONE) {
/* Steep slopes behave the same as slopes with one corner raised. */
const Slope normalised_tileh = IsSteepSlope(tileh) ? SlopeWithOneCornerRaised(GetHighestSlopeCorner(tileh)) : tileh;
if ((_invalid_tileh_slopes_road[0][normalised_tileh & SLOPE_ELEVATED] & (pieces & ~entrance_piece)) != ROAD_NONE) {
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}

@ -1556,7 +1556,7 @@ static int GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y)
if (5 <= pos && pos <= 10) return z;
} else { // IsBridge(tile)
if (IsRoadCustomBridgeHeadTile(tile)) {
return z + TILE_HEIGHT;
return z + TILE_HEIGHT + (IsSteepSlope(tileh) ? TILE_HEIGHT : 0);
}
DiagDirection dir = GetTunnelBridgeDirection(tile);
@ -1959,7 +1959,11 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
if (IsRoadCustomBridgeHeadTile(tile)) {
const RoadBits pieces = GetCustomBridgeHeadAllRoadBits(tile);
const RoadBits entrance_piece = DiagDirToRoadBits(direction);
if ((_invalid_tileh_slopes_road[0][tileh_new] & (pieces & ~entrance_piece)) != ROAD_NONE) {
/* Steep slopes behave the same as slopes with one corner raised. */
const Slope normalised_tileh_new = IsSteepSlope(tileh_new) ? SlopeWithOneCornerRaised(GetHighestSlopeCorner(tileh_new)) : tileh_new;
if ((_invalid_tileh_slopes_road[0][normalised_tileh_new & SLOPE_ELEVATED] & (pieces & ~entrance_piece)) != ROAD_NONE) {
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}
}

Loading…
Cancel
Save