(svn r23209) -Codechange: track the current active script instance directly, instead of assuming the current company points you to the right one.

This commit is contained in:
truebrain
2011-11-13 20:43:48 +00:00
parent 407514a590
commit b7a655bf4c
9 changed files with 138 additions and 52 deletions

View File

@@ -32,9 +32,8 @@ AIExecMode::AIExecMode()
AIExecMode::~AIExecMode()
{
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("AIExecMode object was removed while it was not the latest AI*Mode object created.");
}
}