1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-24 04:43:49 +00:00

Merge branch 'autostartmenot' into 'master'

Don't add auto started local Lua scripts twice

Closes #8268

See merge request OpenMW/openmw!4497
This commit is contained in:
psi29a 2025-01-02 13:52:18 +00:00
commit 690f95f6d2

View File

@ -92,13 +92,16 @@ namespace LuaUtil
if (hasScript(scriptId))
return false; // already present
LoadedData& data = ensureLoaded();
if (data.mScripts.count(scriptId) != 0)
return false; // bail if the script we're adding was auto started
const VFS::Path::Normalized& path = scriptPath(scriptId);
std::string debugName = mNamePrefix;
debugName.push_back('[');
debugName.append(path);
debugName.push_back(']');
LoadedData& data = ensureLoaded();
Script& script = data.mScripts[scriptId];
script.mHiddenData = view.newTable();
script.mHiddenData[sScriptIdKey] = ScriptId{ this, scriptId };