summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-10-23 20:39:21 +0000
committeralberth <alberth@openttd.org>2010-10-23 20:39:21 +0000
commit83094e5e58f5674df04e204ba946315da25fad3c (patch)
treed67362685f0da1672b03d76ae0e13e1f831ceb48 /src/viewport.cpp
parentcccbc8f418b578d4ad378e5c0570b7f473391ce8 (diff)
downloadopenttd-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.cpp12
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.