diff options
author | frosch <frosch@openttd.org> | 2008-01-25 15:47:58 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-01-25 15:47:58 +0000 |
commit | 6f6708e8448f891bc03c87c630a0c8f9cf47d332 (patch) | |
tree | f904e7af79be7c749721bcae930333e27ad88830 /src/tunnelbridge_cmd.cpp | |
parent | d11aeb118c7a0b5f6c1900dfcdcfd97ea2333097 (diff) | |
download | openttd-6f6708e8448f891bc03c87c630a0c8f9cf47d332.tar.xz |
(svn r11983) -Codechange: Add some helper functions for slopes and use them.
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index aebc76581..bb1a0e85c 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -465,14 +465,8 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 } start_tileh = GetTileSlope(start_tile, &start_z); - - switch (start_tileh) { - case SLOPE_SW: direction = DIAGDIR_SW; break; - case SLOPE_SE: direction = DIAGDIR_SE; break; - case SLOPE_NW: direction = DIAGDIR_NW; break; - case SLOPE_NE: direction = DIAGDIR_NE; break; - default: return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); - } + direction = GetInclinedSlopeDirection(start_tileh); + if (direction == INVALID_DIAGDIR) return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); if (IsRiverTile(start_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |