Skip to content

Commit

Permalink
Merge branch 'autostartmenot' into 'master'
Browse files Browse the repository at this point in the history
Don't add auto started local Lua scripts twice

Closes #8268

See merge request OpenMW/openmw!4497
  • Loading branch information
psi29a committed Jan 2, 2025
2 parents 6ac0880 + f92b504 commit 690f95f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/lua/scriptscontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 690f95f

Please sign in to comment.