mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r23098) -Codechange: remove pointless multiplications by TILE_HEIGHT from the tunnel code
This commit is contained in:
parent
d0689c2924
commit
f0f17a77ba
|
@ -316,7 +316,7 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
|
||||||
}
|
}
|
||||||
/* Check if tunnel would take damage */
|
/* Check if tunnel would take damage */
|
||||||
if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
|
if (direction == -1 && IsTunnelInWay(tile, z_min)) {
|
||||||
_terraform_err_tile = tile; // highlight the tile above the tunnel
|
_terraform_err_tile = tile; // highlight the tile above the tunnel
|
||||||
return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
|
return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ TileIndex GetOtherTunnelEnd(TileIndex tile)
|
||||||
{
|
{
|
||||||
DiagDirection dir = GetTunnelBridgeDirection(tile);
|
DiagDirection dir = GetTunnelBridgeDirection(tile);
|
||||||
TileIndexDiff delta = TileOffsByDiagDir(dir);
|
TileIndexDiff delta = TileOffsByDiagDir(dir);
|
||||||
uint z = GetTilePixelZ(tile);
|
uint z = GetTileZ(tile);
|
||||||
|
|
||||||
dir = ReverseDiagDir(dir);
|
dir = ReverseDiagDir(dir);
|
||||||
do {
|
do {
|
||||||
|
@ -31,7 +31,7 @@ TileIndex GetOtherTunnelEnd(TileIndex tile)
|
||||||
} while (
|
} while (
|
||||||
!IsTunnelTile(tile) ||
|
!IsTunnelTile(tile) ||
|
||||||
GetTunnelBridgeDirection(tile) != dir ||
|
GetTunnelBridgeDirection(tile) != dir ||
|
||||||
GetTilePixelZ(tile) != z
|
GetTileZ(tile) != z
|
||||||
);
|
);
|
||||||
|
|
||||||
return tile;
|
return tile;
|
||||||
|
@ -53,7 +53,7 @@ bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
|
||||||
do {
|
do {
|
||||||
tile -= delta;
|
tile -= delta;
|
||||||
if (!IsValidTile(tile)) return false;
|
if (!IsValidTile(tile)) return false;
|
||||||
height = GetTilePixelZ(tile);
|
height = GetTileZ(tile);
|
||||||
} while (z < height);
|
} while (z < height);
|
||||||
|
|
||||||
return z == height && IsTunnelTile(tile) && GetTunnelBridgeDirection(tile) == dir;
|
return z == height && IsTunnelTile(tile) && GetTunnelBridgeDirection(tile) == dir;
|
||||||
|
|
|
@ -113,7 +113,7 @@ Foundation GetBridgeFoundation(Slope tileh, Axis axis)
|
||||||
*/
|
*/
|
||||||
bool HasBridgeFlatRamp(Slope tileh, Axis axis)
|
bool HasBridgeFlatRamp(Slope tileh, Axis axis)
|
||||||
{
|
{
|
||||||
ApplyPixelFoundationToSlope(GetBridgeFoundation(tileh, axis), &tileh);
|
ApplyFoundationToSlope(GetBridgeFoundation(tileh, axis), &tileh);
|
||||||
/* If the foundation slope is flat the bridge has a non-flat ramp and vice versa. */
|
/* If the foundation slope is flat the bridge has a non-flat ramp and vice versa. */
|
||||||
return (tileh != SLOPE_FLAT);
|
return (tileh != SLOPE_FLAT);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
|
||||||
|
|
||||||
uint start_z;
|
uint start_z;
|
||||||
uint end_z;
|
uint end_z;
|
||||||
Slope start_tileh = GetTilePixelSlope(start_tile, &start_z);
|
Slope start_tileh = GetTileSlope(start_tile, &start_z);
|
||||||
DiagDirection direction = GetInclinedSlopeDirection(start_tileh);
|
DiagDirection direction = GetInclinedSlopeDirection(start_tileh);
|
||||||
if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE_FOR_TUNNEL);
|
if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE_FOR_TUNNEL);
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1,
|
||||||
for (;;) {
|
for (;;) {
|
||||||
end_tile += delta;
|
end_tile += delta;
|
||||||
if (!IsValidTile(end_tile)) return_cmd_error(STR_ERROR_TUNNEL_THROUGH_MAP_BORDER);
|
if (!IsValidTile(end_tile)) return_cmd_error(STR_ERROR_TUNNEL_THROUGH_MAP_BORDER);
|
||||||
end_tileh = GetTilePixelSlope(end_tile, &end_z);
|
end_tileh = GetTileSlope(end_tile, &end_z);
|
||||||
|
|
||||||
if (start_z == end_z) break;
|
if (start_z == end_z) break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue