mirror of https://github.com/OpenTTD/OpenTTD
(svn r17545) -Fix [FS#3202]: [NoAI] AIs had 'infinite' time when running code from the global scope
parent
227824f753
commit
f2487381ce
|
@ -142,7 +142,8 @@ AIInstance::AIInstance(AIInfo *info) :
|
|||
if (strcmp(main_script, "%_dummy") == 0) {
|
||||
extern void AI_CreateAIDummy(HSQUIRRELVM vm);
|
||||
AI_CreateAIDummy(this->engine->GetVM());
|
||||
} else if (!this->engine->LoadScript(main_script)) {
|
||||
} else if (!this->engine->LoadScript(main_script) || this->engine->IsSuspended()) {
|
||||
if (this->engine->IsSuspended()) AILog::Error("This AI took too long to load script. AI is not started.");
|
||||
this->Died();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ static SQInteger _io_file_read(SQUserPointer file, SQUserPointer buf, SQInteger
|
|||
/* Load and run the script */
|
||||
if (SQ_SUCCEEDED(LoadFile(vm, script, SQTrue))) {
|
||||
sq_push(vm, -2);
|
||||
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) {
|
||||
if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue, 100000))) {
|
||||
sq_pop(vm, 1);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue