changeset 17493:9e2b60947a54 draft

(svn r22248) -Codechange: Make OnInvalidateData() process 'delete this;' already in command scope.
author frosch <frosch@openttd.org>
date Sun, 13 Mar 2011 21:34:49 +0000
parents b50ba9cf01a9
children 24022375538e
files src/ai/ai_gui.cpp src/misc_gui.cpp src/network/network_chat_gui.cpp
diffstat 3 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -189,12 +189,13 @@
 	 */
 	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 @@
 	 */
 	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;
 	}
 };
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -652,7 +652,6 @@
 	 */
 	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;
 	}
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -538,7 +538,6 @@
 	 */
 	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 	{
-		if (!gui_scope) return;
 		if (data == this->dest) delete this;
 	}
 };