diff --git a/src/lang/english.txt b/src/lang/english.txt index 99025ae627..8ec1250b89 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2630,6 +2630,7 @@ STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOOLTIP :{BLACK}Select t # Land area window STR_LAND_AREA_INFORMATION_CAPTION :{WHITE}Land Area Information +STR_LAND_AREA_INFORMATION_LOCATION_TOOLTIP :{BLACK}Centre the main view on tile location. Ctrl+Click opens a new viewport on tile location STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A :{BLACK}Cost to clear: {LTBLUE}N/A STR_LAND_AREA_INFORMATION_COST_TO_CLEAR :{BLACK}Cost to clear: {RED}{CURRENCY_LONG} STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED :{BLACK}Revenue when cleared: {LTBLUE}{CURRENCY_LONG} diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 1c7b768bd8..e5da5f3a12 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -25,6 +25,7 @@ #include "newgrf_debug.h" #include "zoom_func.h" #include "guitimer_func.h" +#include "viewport_func.h" #include "rev.h" #include "widgets/misc_widget.h" @@ -46,6 +47,7 @@ static const NWidgetPart _nested_land_info_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_LI_LOCATION), SetMinimalSize(12, 14), SetDataTip(SPR_GOTO_LOCATION, STR_LAND_AREA_INFORMATION_LOCATION_TOOLTIP), NWidget(WWT_DEBUGBOX, COLOUR_GREY), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(), @@ -361,6 +363,19 @@ public: ::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile); } + void OnClick(Point pt, int widget, int click_count) override + { + switch (widget) { + case WID_LI_LOCATION: + if (_ctrl_pressed) { + ShowExtraViewportWindow(this->tile); + } else { + ScrollMainWindowToTile(this->tile); + } + break; + } + } + /** * Some data on this window has become invalid. * @param data Information about the changed data. diff --git a/src/widgets/misc_widget.h b/src/widgets/misc_widget.h index 0fdfc8c605..f62234405f 100644 --- a/src/widgets/misc_widget.h +++ b/src/widgets/misc_widget.h @@ -12,6 +12,7 @@ /** Widgets of the #LandInfoWindow class. */ enum LandInfoWidgets { + WID_LI_LOCATION, ///< Scroll to location. WID_LI_BACKGROUND, ///< Background of the window. };