diff options
author | zuu <zuu@openttd.org> | 2013-10-12 22:07:58 +0000 |
---|---|---|
committer | zuu <zuu@openttd.org> | 2013-10-12 22:07:58 +0000 |
commit | dfb566331390a87f01d048f57ed6d51b2f329d65 (patch) | |
tree | 76bcf6959e2acb63051f9f74a80b8154b95bc824 /src/water_cmd.cpp | |
parent | b35b8aa5bb38f9e47ca04ccd9302dd82546de0cd (diff) | |
download | openttd-dfb566331390a87f01d048f57ed6d51b2f329d65.tar.xz |
(svn r25849) -Codechange: Introduce IsTileFlat to not compute full slope information for situations when we only want to know if a tile is flat or not (cirdan, LordAro)
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r-- | src/water_cmd.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index b99741cfe..263731937 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -110,7 +110,7 @@ CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui if ((MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) || (MayHaveBridgeAbove(tile2) && IsBridgeAbove(tile2))) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); - if (GetTileSlope(tile) != SLOPE_FLAT || GetTileSlope(tile2) != SLOPE_FLAT) { + if (!IsTileFlat(tile) || !IsTileFlat(tile2)) { /* Prevent depots on rapids */ return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } @@ -270,7 +270,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag cost.AddCost(ret); cost.AddCost(_price[PR_BUILD_CANAL]); } - if (GetTileSlope(tile - delta) != SLOPE_FLAT) { + if (!IsTileFlat(tile - delta)) { return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); } @@ -283,7 +283,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag cost.AddCost(ret); cost.AddCost(_price[PR_BUILD_CANAL]); } - if (GetTileSlope(tile + delta) != SLOPE_FLAT) { + if (!IsTileFlat(tile + delta)) { return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); } @@ -590,7 +590,7 @@ bool IsWateredTile(TileIndex tile, Direction from) return IsTileOnWater(tile); } - return (IsDock(tile) && GetTileSlope(tile) == SLOPE_FLAT) || IsBuoy(tile); + return (IsDock(tile) && IsTileFlat(tile)) || IsBuoy(tile); case MP_INDUSTRY: { /* Do not draw waterborders inside of industries. @@ -1240,7 +1240,7 @@ static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode, if (mode != TRANSPORT_WATER) return 0; switch (GetWaterTileType(tile)) { - case WATER_TILE_CLEAR: ts = (GetTileSlope(tile) == SLOPE_FLAT) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break; + case WATER_TILE_CLEAR: ts = IsTileFlat(tile) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break; case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTileSlope(tile) & 0xF]; break; case WATER_TILE_LOCK: ts = DiagDirToDiagTrackBits(GetLockDirection(tile)); break; case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break; |