changeset 18554:861edb824eb8 draft

(svn r23398) -Fix: the AIEvent.ET_COMPANY_NEW was only triggered if a company named itself, which seems like a very odd place to do so. Trigger it when the company is created instead
author truebrain <truebrain@openttd.org>
date Fri, 02 Dec 2011 23:40:24 +0000
parents ad8b29abd4d7
children 9dd1621dadfe
files src/company_cmd.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -375,7 +375,6 @@
 			SetDParam(3, t->index);
 			AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NS_COMPANY_NEW, NR_TILE, c->last_build_coordinate, NR_NONE, UINT32_MAX, cni);
 		}
-		AI::BroadcastNewEvent(new ScriptEventCompanyNew(c->index), c->index);
 		return;
 	}
 bad_town_name:;
@@ -563,6 +562,8 @@
 
 	if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index);
 
+	AI::BroadcastNewEvent(new ScriptEventCompanyNew(c->index), c->index);
+
 	return c;
 }