From b7a655bf4cafc68e14cade593e8b1aca7f04f7dd Mon Sep 17 00:00:00 2001 From: truebrain Date: Sun, 13 Nov 2011 20:43:48 +0000 Subject: (svn r23209) -Codechange: track the current active script instance directly, instead of assuming the current company points you to the right one. --- src/ai/api/ai_testmode.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ai/api/ai_testmode.cpp') 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."); } } -- cgit v1.2.3-70-g09d2