mirror of https://github.com/OpenTTD/OpenTTD
(svn r17544) -Fix [FS#3202]: [NoAI] Crash when doing commands in the 'global' scope
parent
4dfef325ce
commit
227824f753
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue