Script: Allow text param mismatches for scripts with 13 or below compatibility

This commit is contained in:
Jonathan G Rennison
2023-03-20 17:47:19 +00:00
parent 6fb3fa7e77
commit a6babb23d3
4 changed files with 53 additions and 7 deletions

View File

@@ -62,7 +62,8 @@ ScriptInstance::ScriptInstance(const char *APIName) :
is_paused(false),
in_shutdown(false),
callback(nullptr),
APIName(APIName)
APIName(APIName),
allow_text_param_mismatch(false)
{
this->storage = new ScriptStorage();
this->engine = new Squirrel(APIName);
@@ -122,6 +123,16 @@ void ScriptInstance::RegisterAPI()
bool ScriptInstance::LoadCompatibilityScripts(const char *api_version, Subdirectory dir)
{
const char *api_vers[] = { "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "12", "13", "14" };
uint api_idx = 0;
for (; api_idx < lengthof(api_vers) ; api_idx++) {
if (strcmp(api_version, api_vers[api_idx]) == 0) break;
}
if (api_idx < 12) {
/* 13 and below */
this->allow_text_param_mismatch = true;
}
char script_name[32];
seprintf(script_name, lastof(script_name), "compat_%s.nut", api_version);
for (Searchpath sp : _valid_searchpaths) {