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/dock_gui.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/dock_gui.cpp')
-rw-r--r-- | src/dock_gui.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index bdb0282d5..2c36a1616 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -19,6 +19,7 @@ #include "viewport_func.h" #include "gfx_func.h" #include "player_func.h" +#include "slope_func.h" #include "table/sprites.h" #include "table/strings.h" @@ -189,14 +190,11 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e) TileIndex tile_from; TileIndex tile_to; - tile_from = tile_to = e->we.place.tile; - switch (GetTileSlope(tile_from, NULL)) { - case SLOPE_SW: tile_to += TileDiffXY(-1, 0); break; - case SLOPE_SE: tile_to += TileDiffXY( 0, -1); break; - case SLOPE_NW: tile_to += TileDiffXY( 0, 1); break; - case SLOPE_NE: tile_to += TileDiffXY( 1, 0); break; - default: break; - } + tile_from = e->we.place.tile; + + DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, NULL)); + tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile_from, ReverseDiagDir(dir)) : tile_from); + VpSetPresizeRange(tile_from, tile_to); } break; |