summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-06-05 13:29:48 +0000
committerfrosch <frosch@openttd.org>2010-06-05 13:29:48 +0000
commite852bf154f2af40b3cee1f67bef41a78c2056de5 (patch)
tree159b22af34bafe9265096b10e8405c89171907ce
parent1d3adb2b66989630b2a3c201ac1210a886d41a51 (diff)
downloadopenttd-e852bf154f2af40b3cee1f67bef41a78c2056de5.tar.xz
(svn r19932) -Codechange: Preserve _current_company when starting AIs.
-rw-r--r--src/ai/ai_core.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp
index 8d333877f..ab950ef06 100644
--- a/src/ai/ai_core.cpp
+++ b/src/ai/ai_core.cpp
@@ -48,13 +48,15 @@
config->ChangeAI(info->GetName(), -1, false, true);
}
- _current_company = company;
+ Backup<CompanyByte> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
c->ai_info = info;
assert(c->ai_instance == NULL);
c->ai_instance = new AIInstance(info);
+ cur_company.Restore();
+
InvalidateWindowData(WC_AI_DEBUG, 0, -1);
return;
}