summaryrefslogtreecommitdiff
path: root/src/dock_gui.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-07 23:06:23 +0100
committerPatric Stout <github@truebrain.nl>2021-01-08 16:43:51 +0100
commitaf22a4f2cda86a7667578281a51ea1ec08a49af6 (patch)
treeef59fd78c7d3e2b68594bfbe22b43a6abaf0001e /src/dock_gui.cpp
parent85a49a0d3605b83b911c57c6e5cc9d8b79365131 (diff)
downloadopenttd-af22a4f2cda86a7667578281a51ea1ec08a49af6.tar.xz
Add: show in the tooltip of disabled toolbar buttons why they are disabled
Diffstat (limited to 'src/dock_gui.cpp')
-rw-r--r--src/dock_gui.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 7e2d61857..39237f5ca 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -125,6 +125,15 @@ struct BuildDocksToolbarWindow : Window {
if (!can_build) {
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
+
+ /* Show in the tooltip why this button is disabled. */
+ this->GetWidget<NWidgetCore>(WID_DT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
+ this->GetWidget<NWidgetCore>(WID_DT_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
+ this->GetWidget<NWidgetCore>(WID_DT_BUOY)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
+ } else {
+ this->GetWidget<NWidgetCore>(WID_DT_DEPOT)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP);
+ this->GetWidget<NWidgetCore>(WID_DT_STATION)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP);
+ this->GetWidget<NWidgetCore>(WID_DT_BUOY)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP);
}
}