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