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 | d4dc5e07752762ee4d6a425a533786b26257a438 (patch) | |
tree | f904e7af79be7c749721bcae930333e27ad88830 /src/station_cmd.cpp | |
parent | d13311e710c2ed0b1af134c778a5d6157c34ea20 (diff) | |
download | openttd-d4dc5e07752762ee4d6a425a533786b26257a438.tar.xz |
(svn r11983) -Codechange: Add some helper functions for slopes and use them.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 8b30d98de..a31a3d053 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1945,14 +1945,9 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { CommandCost cost; - DiagDirection direction; - switch (GetTileSlope(tile, NULL)) { - case SLOPE_SW: direction = DIAGDIR_NE; break; - case SLOPE_SE: direction = DIAGDIR_NW; break; - case SLOPE_NW: direction = DIAGDIR_SE; break; - case SLOPE_NE: direction = DIAGDIR_SW; break; - default: return_cmd_error(STR_304B_SITE_UNSUITABLE); - } + DiagDirection direction = GetInclinedSlopeDirection(GetTileSlope(tile, NULL)); + if (direction == INVALID_DIAGDIR) return_cmd_error(STR_304B_SITE_UNSUITABLE); + direction = ReverseDiagDir(direction); /* Docks cannot be placed on rapids */ if (IsRiverTile(tile)) return_cmd_error(STR_304B_SITE_UNSUITABLE); |