Merge pull request #785 from diamante0018/develop

[Script]: Optimize loading
This commit is contained in:
Edo 2023-02-20 16:58:20 +01:00 committed by GitHub
commit f9f817fc9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,10 +55,14 @@ namespace Components
const auto* scriptFile = files[i];
Logger::Print("Loading script {}...\n", scriptFile);
sprintf_s(path, "%s/%s", "scripts", scriptFile);
const auto len = sprintf_s(path, "%s/%s", "scripts", scriptFile);
if (len == -1)
{
continue;
}
// Scr_LoadScriptInternal will add the '.gsc' suffix so we remove it
path[std::strlen(path) - 4] = '\0';
path[len - 4] = '\0';
if (!Game::Scr_LoadScript(path))
{