1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 11:29:54 +00:00

Don't add auto started local Lua scripts twice

This commit is contained in:
Evil Eye 2025-01-01 13:21:28 +01:00
parent b29949d5a7
commit f92b5040c6

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 };