(svn r17544) -Fix [FS#3202]: [NoAI] Crash when doing commands in the 'global' scope

This commit is contained in:
rubidium
2009-09-15 16:16:28 +00:00
parent f7f0a567a7
commit 3e3927cfcc

View File

@@ -135,6 +135,8 @@ AIInstance::AIInstance(AIInfo *info) :
return;
}
try {
AIObject::SetAllowDoCommand(false);
/* Load and execute the script for this AI */
const char *main_script = info->GetMainScript();
if (strcmp(main_script, "%_dummy") == 0) {
@@ -151,6 +153,13 @@ AIInstance::AIInstance(AIInfo *info) :
this->Died();
return;
}
AIObject::SetAllowDoCommand(true);
} catch (AI_FatalError e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
}
AIInstance::~AIInstance()