From 15b486e1499fad91875722e03589cf2cb6617b81 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 26 Jun 2014 01:21:15 +0200 Subject: [PATCH] Don't trigger changed flag if a script with no locals is configured --- apps/openmw/mwscript/locals.cpp | 5 +++++ apps/openmw/mwscript/locals.hpp | 3 +++ apps/openmw/mwworld/refdata.cpp | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/locals.cpp b/apps/openmw/mwscript/locals.cpp index 094fe085a..177536fe9 100644 --- a/apps/openmw/mwscript/locals.cpp +++ b/apps/openmw/mwscript/locals.cpp @@ -21,6 +21,11 @@ namespace MWScript mFloats.resize (script.mData.mNumFloats, 0); } + bool Locals::isEmpty() const + { + return (mShorts.empty() && mLongs.empty() && mFloats.empty()); + } + int Locals::getIntVar(const std::string &script, const std::string &var) { Compiler::Locals locals = MWBase::Environment::get().getScriptManager()->getLocals(script); diff --git a/apps/openmw/mwscript/locals.hpp b/apps/openmw/mwscript/locals.hpp index d17d1be2d..1e8c6e12a 100644 --- a/apps/openmw/mwscript/locals.hpp +++ b/apps/openmw/mwscript/locals.hpp @@ -20,6 +20,9 @@ namespace MWScript std::vector mLongs; std::vector mFloats; + /// Are there any locals? + bool isEmpty() const; + void configure (const ESM::Script& script); bool setVarByInt(const std::string& script, const std::string& var, int val); int getIntVar (const std::string& script, const std::string& var); ///< if var does not exist, returns 0 diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index 3b7521e8d..f4bc64b70 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -152,7 +152,8 @@ namespace MWWorld { mLocals.configure (script); mHasLocals = true; - mChanged = true; + if (!mLocals.isEmpty()) + mChanged = true; } }