diff options
author | frosch <frosch@openttd.org> | 2010-10-16 23:13:05 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-10-16 23:13:05 +0000 |
commit | 918da8432ae709e002448c947550674e1f4ae278 (patch) | |
tree | 786acbfb6c1a7710aa9549c66d446ba3be542490 /src | |
parent | 6063bbf321e3135032b25e3bbb076068de281924 (diff) | |
download | openttd-918da8432ae709e002448c947550674e1f4ae278.tar.xz |
(svn r20956) -Feature: Center new extra viewports on the tile below the mouse. Only center on center of main viewport if mouse is not in any viewport.
Diffstat (limited to 'src')
-rw-r--r-- | src/viewport_gui.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 26815c5d5..1a919fe10 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -17,6 +17,7 @@ #include "strings_func.h" #include "zoom_func.h" #include "window_func.h" +#include "tilehighlight_func.h" #include "table/strings.h" #include "table/sprites.h" @@ -70,7 +71,12 @@ public: Point pt; if (tile == INVALID_TILE) { - /* the main window with the main view */ + /* Use tile under mouse as center for new viewport */ + Point pt = GetTileBelowCursor(); + if (pt.x != -1) tile = TileVirtXY(pt.x, pt.y); + } + if (tile == INVALID_TILE) { + /* Still no tile? Use center of main viewport. */ const Window *w = FindWindowById(WC_MAIN_WINDOW, 0); /* center on same place as main window (zoom is maximum, no adjustment needed) */ |