Merge branch 'custom_bridgeheads' into jgrpp

This commit is contained in:
Jonathan G Rennison
2017-03-23 20:15:45 +00:00
2 changed files with 11 additions and 3 deletions

View File

@@ -731,7 +731,11 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if ((pieces & ~axial_pieces) && !_settings_game.construction.build_on_slopes) { if ((pieces & ~axial_pieces) && !_settings_game.construction.build_on_slopes) {
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); 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); return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
} }

View File

@@ -1823,7 +1823,7 @@ static int GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y)
if (5 <= pos && pos <= 10) return z; if (5 <= pos && pos <= 10) return z;
} else { // IsBridge(tile) } else { // IsBridge(tile)
if (IsRoadCustomBridgeHeadTile(tile)) { if (IsRoadCustomBridgeHeadTile(tile)) {
return z + TILE_HEIGHT; return z + TILE_HEIGHT + (IsSteepSlope(tileh) ? TILE_HEIGHT : 0);
} }
DiagDirection dir = GetTunnelBridgeDirection(tile); DiagDirection dir = GetTunnelBridgeDirection(tile);
@@ -2265,7 +2265,11 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
if (IsRoadCustomBridgeHeadTile(tile)) { if (IsRoadCustomBridgeHeadTile(tile)) {
const RoadBits pieces = GetCustomBridgeHeadAllRoadBits(tile); const RoadBits pieces = GetCustomBridgeHeadAllRoadBits(tile);
const RoadBits entrance_piece = DiagDirToRoadBits(direction); 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); return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
} }
} }