diff options
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r-- | src/rail_gui.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 17c6cec9b..a8c2fc6b3 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -435,6 +435,18 @@ 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. + */ + virtual void OnInvalidateData(int data = 0, bool gui_scope = true) + { + if (!gui_scope) return; + + if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) delete this; + } + + /** * Configures the rail toolbar for railtype given * @param railtype the railtype to display */ |