summaryrefslogtreecommitdiff
path: root/src/rail_gui.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-07 22:28:08 +0100
committerPatric Stout <github@truebrain.nl>2021-01-08 16:43:51 +0100
commit85a49a0d3605b83b911c57c6e5cc9d8b79365131 (patch)
tree5c98121072bc62f49e89c1636fa675df404df6be /src/rail_gui.cpp
parenta6aec252b1987d11e09f2778e481ae3d6fb916fa (diff)
downloadopenttd-85a49a0d3605b83b911c57c6e5cc9d8b79365131.tar.xz
Change: always allow to click on the toolbar icons for road/rail/dock/airport
This change allows a user to see what is available and what will become available before it is available, instead of only disabling the button with no further explanation. It also always allows building roads and canals, even if no vehicles are available for road / water. For rail/road/tram, a dropdown with available types is shown. If none are available, it reads "None". If the type is not yet available, it is greyed out. For dock/airport, this always open the toolbar, but building airports, docks, and depots buttons are disabled till vehicles are available for those. Road is the only exception, with the primary road always being available. Here too, stations and depots are disabled till vehicles become available. It does mean you can now always build roads to for example help towns grow.
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r--src/rail_gui.cpp13
1 files changed, 0 insertions, 13 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 177f72acc..37c365881 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -437,18 +437,6 @@ struct BuildRailToolbarWindow : Window {
}
/**
- * Some data on this window has become invalid.
- * @param data Information about the changed data.
- * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
- */
- void OnInvalidateData(int data = 0, bool gui_scope = true) override
- {
- if (!gui_scope) return;
-
- if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) delete this;
- }
-
- /**
* Configures the rail toolbar for railtype given
* @param railtype the railtype to display
*/
@@ -781,7 +769,6 @@ struct BuildRailToolbarWindow : Window {
*/
static EventState RailToolbarGlobalHotkeys(int hotkey)
{
- if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED;
extern RailType _last_built_railtype;
Window *w = ShowBuildRailToolbar(_last_built_railtype);
if (w == nullptr) return ES_NOT_HANDLED;