summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_testmode.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-13 20:43:48 +0000
committertruebrain <truebrain@openttd.org>2011-11-13 20:43:48 +0000
commitb7a655bf4cafc68e14cade593e8b1aca7f04f7dd (patch)
tree1880bbb64896193511e72c23c9387af2bb19acae /src/ai/api/ai_testmode.cpp
parent407514a590dc06c8b80c5304b5e9227c8c844f91 (diff)
downloadopenttd-b7a655bf4cafc68e14cade593e8b1aca7f04f7dd.tar.xz
(svn r23209) -Codechange: track the current active script instance directly, instead of assuming the current company points you to the right one.
Diffstat (limited to 'src/ai/api/ai_testmode.cpp')
-rw-r--r--src/ai/api/ai_testmode.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ai/api/ai_testmode.cpp b/src/ai/api/ai_testmode.cpp
index 996b27874..6e2f515b4 100644
--- a/src/ai/api/ai_testmode.cpp
+++ b/src/ai/api/ai_testmode.cpp
@@ -32,9 +32,8 @@ AITestMode::AITestMode()
AITestMode::~AITestMode()
{
if (this->GetDoCommandModeInstance() != this) {
- AIInstance *instance = Company::Get(_current_company)->ai_instance;
/* Ignore this error if the AI already died. */
- if (!instance->IsDead()) {
+ if (!AIObject::GetActiveInstance()->IsDead()) {
throw AI_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created.");
}
}