summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-03-13 21:34:49 +0000
committerfrosch <frosch@openttd.org>2011-03-13 21:34:49 +0000
commit141f2eba50aa0e475a49610b05c00d0f549ae53f (patch)
treeb03abd16f0ccf523b391661001cfb78994f2b336
parent652c9cb6635cc5f72a32077fdcd4e0f4bcc859e0 (diff)
downloadopenttd-141f2eba50aa0e475a49610b05c00d0f549ae53f.tar.xz
(svn r22248) -Codechange: Make OnInvalidateData() process 'delete this;' already in command scope.
-rw-r--r--src/ai/ai_gui.cpp4
-rw-r--r--src/misc_gui.cpp1
-rw-r--r--src/network/network_chat_gui.cpp1
3 files changed, 2 insertions, 4 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 339201a94..e7b704e5c 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -189,12 +189,13 @@ struct AIListWindow : public Window {
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (!gui_scope) return;
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
delete this;
return;
}
+ if (!gui_scope) return;
+
this->vscroll->SetCount((int)this->ai_info_list->size() + 1);
/* selected goes from -1 .. length of ai list - 1. */
@@ -450,7 +451,6 @@ struct AISettingsWindow : public Window {
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (!gui_scope) return;
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this;
}
};
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 4f97bcbf4..137d53388 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -652,7 +652,6 @@ public:
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (!gui_scope) return;
/* If company gets shut down, while displaying an error about it, remove the error message. */
if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this;
}
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index ac7045d8c..6a2c768aa 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -538,7 +538,6 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
- if (!gui_scope) return;
if (data == this->dest) delete this;
}
};