summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2020-12-27 23:25:43 +0100
committerfrosch <github@elsenhans.name>2021-01-11 22:15:58 +0100
commite339188dedbb0a99c56536380aa0f32b31959327 (patch)
treec39136efed0191004484e1fa236ebdaa1c26bf78 /src/misc_gui.cpp
parent1432dbac53aba7c71d12633a0272d64190551d6e (diff)
downloadopenttd-e339188dedbb0a99c56536380aa0f32b31959327.tar.xz
Add: a go-to-location button to the LandInfo window.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 1c7b768bd..e5da5f3a1 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.