diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp --- a/src/ai/ai_instance.cpp +++ b/src/ai/ai_instance.cpp @@ -81,7 +81,6 @@ #include "../company_base.h" #include "../company_func.h" -#include "../fileio_func.h" AIInstance::AIInstance() : ScriptInstance("AI") @@ -194,29 +193,7 @@ void AIInstance::RegisterAPI() SQAIWaypointList_Register(this->engine); SQAIWaypointList_Vehicle_Register(this->engine); - if (!this->LoadCompatibilityScripts(this->versionAPI)) this->Died(); -} - -bool AIInstance::LoadCompatibilityScripts(const char *api_version) -{ - char script_name[32]; - seprintf(script_name, lastof(script_name), "compat_%s.nut", api_version); - char buf[MAX_PATH]; - Searchpath sp; - FOR_ALL_SEARCHPATHS(sp) { - FioAppendDirectory(buf, MAX_PATH, sp, AI_DIR); - ttd_strlcat(buf, script_name, MAX_PATH); - if (!FileExists(buf)) continue; - - if (this->engine->LoadScript(buf)) return true; - - ScriptLog::Error("Failed to load API compatibility script"); - DEBUG(script, 0, "Error compiling / running API compatibility script: %s", buf); - return false; - } - - ScriptLog::Warning("API compatibility script not found"); - return true; + if (!this->LoadCompatibilityScripts(this->versionAPI, AI_DIR)) this->Died(); } void AIInstance::Died()