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/industry_gui.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/industry_gui.cpp') diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 012d0a39d..bc72f1965 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -597,8 +597,14 @@ public: this->RaiseButtons(); } - virtual void OnInvalidateData(int data = 0) + /** + * 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; this->SetupArrays(); const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type); @@ -947,8 +953,14 @@ public: this->SetDirty(); } - 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; const Industry *i = Industry::Get(this->window_number); if (IsProductionAlterable(i)) { const IndustrySpec *ind = GetIndustrySpec(i->type); @@ -1346,8 +1358,14 @@ public: this->BuildSortIndustriesList(); } - 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; /* We can only set the trigger for resorting/rebuilding. * We cannot safely resort at this point, as there might be multiple scheduled invalidations, * and a rebuild needs to be done first though it is scheduled later. */ @@ -2394,13 +2412,15 @@ struct IndustryCargoesWindow : public Window { } /** - * Notify the window about external events. + * Some data on this window has become invalid. + * @param data Information about the changed data. * - data = 0 .. NUM_INDUSTRYTYPES - 1: Display the chain around the given industry. * - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window. - * @param data The event. + * @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) + virtual void OnInvalidateData(int data = 0, bool gui_scope = true) { + if (!gui_scope) return; if (data == NUM_INDUSTRYTYPES) { if (this->IsWidgetLowered(ICW_NOTIFY)) { this->RaiseWidget(ICW_NOTIFY); -- cgit v1.2.3-54-g00ecf