From ec9540a12a9170f8b88e1d715c9321edaeeebfd4 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 13 Mar 2011 21:31:29 +0000 Subject: (svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData(). --- src/vehicle_gui.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'src/vehicle_gui.cpp') 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(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. -- cgit v1.2.3-70-g09d2