diff options
author | alberth <alberth@openttd.org> | 2010-10-23 20:39:21 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-10-23 20:39:21 +0000 |
commit | 83094e5e58f5674df04e204ba946315da25fad3c (patch) | |
tree | d67362685f0da1672b03d76ae0e13e1f831ceb48 /src/viewport.cpp | |
parent | cccbc8f418b578d4ad378e5c0570b7f473391ce8 (diff) | |
download | openttd-83094e5e58f5674df04e204ba946315da25fad3c.tar.xz |
(svn r21020) -Add: Use center of waypoint in waypoint gui, if available.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index 6469b10c5..c41c2d309 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1887,6 +1887,18 @@ bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant) } /** + * Scrolls the viewport in a window to a given location. + * @param tile Desired tile to center on. + * @param w %Window containing the viewport. + * @param instant Jump to the location instead of slowly moving to it. + * @return Destination of the viewport was changed (to activate other actions when the viewport is already at the desired position). + */ +bool ScrollWindowToTile(TileIndex tile, Window *w, bool instant) +{ + return ScrollWindowTo(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, -1, w, instant); +} + +/** * Scrolls the viewport of the main window to a given location. * @param tile Desired tile to center on. * @param instant Jump to the location instead of slowly moving to it. |