* Scrolls the main window to given coordinates. * @param x x coordinate * @param y y coordinate * @param z z coordinate; -1 to scroll to terrain height * @param instant scroll instantly (meaningful only when smooth_scrolling is active) * @return did the viewport position change? */
| 2076 | * @return did the viewport position change? |
| 2077 | */ |
| 2078 | bool ScrollMainWindowTo(int x, int y, int z, bool instant) |
| 2079 | { |
| 2080 | bool res = ScrollWindowTo(x, y, z, GetMainWindow(), instant); |
| 2081 | |
| 2082 | /* If a user scrolls to a tile (via what way what so ever) and already is on |
| 2083 | * that tile (e.g.: pressed twice), move the smallmap to that location, |
| 2084 | * so you directly see where you are on the smallmap. */ |
| 2085 | |
| 2086 | if (res) return res; |
| 2087 | |
| 2088 | SmallMapWindow *w = dynamic_cast<SmallMapWindow*>(FindWindowById(WC_SMALLMAP, 0)); |
| 2089 | if (w != nullptr) w->SmallMapCenterOnCurrentPos(); |
| 2090 | |
| 2091 | return res; |
| 2092 | } |
| 2093 | |
| 2094 | /** |
| 2095 | * Determine the middle of a station in the smallmap window. |
no test coverage detected