summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-03-13 21:31:29 +0000
committerfrosch <frosch@openttd.org>2011-03-13 21:31:29 +0000
commitec9540a12a9170f8b88e1d715c9321edaeeebfd4 (patch)
treecf64959e316864d6bc84aead29e805c902fec8a4 /src/industry_gui.cpp
parent0ff6c8f42522f2b440f939baa49c42a14bb8fc85 (diff)
downloadopenttd-ec9540a12a9170f8b88e1d715c9321edaeeebfd4.tar.xz
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp32
1 files changed, 26 insertions, 6 deletions
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);