mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
stop local scripts from being run twice in case of activation
This commit is contained in:
parent
7a313f24ab
commit
15124601aa
2 changed files with 16 additions and 5 deletions
|
@ -38,13 +38,18 @@ void OMW::Engine::executeLocalScripts()
|
||||||
mEnvironment.mWorld->getLocalScripts().begin());
|
mEnvironment.mWorld->getLocalScripts().begin());
|
||||||
iter!=mEnvironment.mWorld->getLocalScripts().end(); ++iter)
|
iter!=mEnvironment.mWorld->getLocalScripts().end(); ++iter)
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext interpreterContext (mEnvironment,
|
if (!mIgnoreLocalPtr.isEmpty() && mIgnoreLocalPtr!=iter->second)
|
||||||
&iter->second.getRefData().getLocals(), MWWorld::Ptr (iter->second));
|
{
|
||||||
mScriptManager->run (iter->first, interpreterContext);
|
MWScript::InterpreterContext interpreterContext (mEnvironment,
|
||||||
|
&iter->second.getRefData().getLocals(), MWWorld::Ptr (iter->second));
|
||||||
|
mScriptManager->run (iter->first, interpreterContext);
|
||||||
|
|
||||||
if (mEnvironment.mWorld->hasCellChanged())
|
if (mEnvironment.mWorld->hasCellChanged())
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mIgnoreLocalPtr = MWWorld::Ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
|
@ -291,7 +296,10 @@ void OMW::Engine::activate()
|
||||||
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
|
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
|
||||||
|
|
||||||
if (!script.empty())
|
if (!script.empty())
|
||||||
|
{
|
||||||
|
mIgnoreLocalPtr = ptr;
|
||||||
mScriptManager->run (script, interpreterContext);
|
mScriptManager->run (script, interpreterContext);
|
||||||
|
}
|
||||||
|
|
||||||
if (!interpreterContext.hasActivationBeenHandled())
|
if (!interpreterContext.hasActivationBeenHandled())
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <components/compiler/extensions.hpp>
|
#include <components/compiler/extensions.hpp>
|
||||||
|
|
||||||
#include "mwworld/environment.hpp"
|
#include "mwworld/environment.hpp"
|
||||||
|
#include "mwworld/ptr.hpp"
|
||||||
|
|
||||||
namespace Compiler
|
namespace Compiler
|
||||||
{
|
{
|
||||||
|
@ -68,6 +69,8 @@ namespace OMW
|
||||||
int focusFrameCounter;
|
int focusFrameCounter;
|
||||||
static const int focusUpdateFrame = 10;
|
static const int focusUpdateFrame = 10;
|
||||||
|
|
||||||
|
MWWorld::Ptr mIgnoreLocalPtr;
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
Engine (const Engine&);
|
Engine (const Engine&);
|
||||||
Engine& operator= (const Engine&);
|
Engine& operator= (const Engine&);
|
||||||
|
|
Loading…
Reference in a new issue