[Script]: Optimize loading

This commit is contained in:
Diavolo 2023-02-20 16:48:52 +01:00
parent af96e5e273
commit 067ef0c2aa
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5

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))
{