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/dock_gui.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/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; |