mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Queue auto started scripts until next update
This commit is contained in:
parent
ad8a05e2a1
commit
76915ce6e9
@ -166,6 +166,10 @@ namespace MWLua
|
||||
|
||||
mObjectLists.update();
|
||||
|
||||
for (auto scripts : mQueuedAutoStartedScripts)
|
||||
scripts->addAutoStartedScripts();
|
||||
mQueuedAutoStartedScripts.clear();
|
||||
|
||||
std::erase_if(mActiveLocalScripts,
|
||||
[](const LocalScripts* l) { return l->getPtrOrEmpty().isEmpty() || l->getPtrOrEmpty().mRef->isDeleted(); });
|
||||
|
||||
@ -343,7 +347,7 @@ namespace MWLua
|
||||
if (!localScripts)
|
||||
{
|
||||
localScripts = createLocalScripts(ptr);
|
||||
localScripts->addAutoStartedScripts();
|
||||
mQueuedAutoStartedScripts.push_back(localScripts);
|
||||
}
|
||||
mActiveLocalScripts.insert(localScripts);
|
||||
mEngineEvents.addToQueue(EngineEvents::OnActive{ getId(ptr) });
|
||||
@ -459,7 +463,7 @@ namespace MWLua
|
||||
if (!autoStartConf.empty())
|
||||
{
|
||||
localScripts = createLocalScripts(ptr, std::move(autoStartConf));
|
||||
localScripts->addAutoStartedScripts(); // TODO: put to a queue and apply on next `update()`
|
||||
mQueuedAutoStartedScripts.push_back(localScripts);
|
||||
}
|
||||
}
|
||||
if (localScripts)
|
||||
|
@ -176,6 +176,7 @@ namespace MWLua
|
||||
MenuScripts mMenuScripts{ &mLua };
|
||||
GlobalScripts mGlobalScripts{ &mLua };
|
||||
std::set<LocalScripts*> mActiveLocalScripts;
|
||||
std::vector<LocalScripts*> mQueuedAutoStartedScripts;
|
||||
ObjectLists mObjectLists;
|
||||
|
||||
MWWorld::Ptr mPlayer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user