diff options
author | truelight <truelight@openttd.org> | 2006-08-21 17:41:04 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-21 17:41:04 +0000 |
commit | 7c6ec91ef7e972ed207a605dcb1e2addcceb84a3 (patch) | |
tree | bf2bfe424cc78c0728f807566e4ac604ca593fe8 /viewport.c | |
parent | 0663fdfc1a50d3a333d4c6157bdf4b41cd9ee2c0 (diff) | |
download | openttd-7c6ec91ef7e972ed207a605dcb1e2addcceb84a3.tar.xz |
(svn r6040) -Add: when clicking twice on a Location Button, the SmallMap centers on your position (based on FS#54 by thomasdev)
-Add: when clicking twice in SmallMap on a position, it centers there (based on FS#54 by thomasdev)
-Add: add a button in SmallMap that centers the SmallMap on your current position (based on FS#54 by thomasdev)
Diffstat (limited to 'viewport.c')
-rw-r--r-- | viewport.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/viewport.c b/viewport.c index ed22304ce..041d2b286 100644 --- a/viewport.c +++ b/viewport.c @@ -1788,7 +1788,21 @@ bool ScrollWindowTo(int x , int y, Window *w) bool ScrollMainWindowTo(int x, int y) { - return ScrollWindowTo(x, y, FindWindowById(WC_MAIN_WINDOW, 0)); + Window *w; + bool res = ScrollWindowTo(x, y, FindWindowById(WC_MAIN_WINDOW, 0)); + + /* If a user scrolls to a tile (via what way what so ever) and already is on + * that tile (e.g.: pressed twice), move the smallmap to that location, + * so you directly see where you are on the smallmap. */ + + if (res) return res; + + w = FindWindowById(WC_SMALLMAP, 0); + if (w == NULL) return res; + + SmallMapCenterOnCurrentPos(w); + + return res; } |