diff options
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index f8ff6d5c1..26b8666a3 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -683,8 +683,14 @@ struct RefitWindow : public Window { } } - virtual void OnInvalidateData(int data) + /** + * 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; switch (data) { case -666: /* Autoreplace replaced the vehicle. @@ -1600,8 +1606,14 @@ public: this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } - virtual void OnInvalidateData(int data) + /** + * 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 (HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) { this->vli.index = GB(data, 0, 20); this->window_number = this->vli.Pack(); @@ -1787,8 +1799,14 @@ struct VehicleDetailsWindow : Window { this->tab = TDW_TAB_CARGO; } - virtual void OnInvalidateData(int data) + /** + * 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 (data == -666) { /* Autoreplace replaced the vehicle. * Nothing to do for this window though. @@ -2596,8 +2614,14 @@ public: } } - virtual void OnInvalidateData(int data) + /** + * 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 (data == -666) { /* Autoreplace replaced the vehicle. * Nothing to do for this window though. |