diff --git a/apps/openmw/mwworld/livecellref.cpp b/apps/openmw/mwworld/livecellref.cpp index c15f63abe..0fbb26c84 100644 --- a/apps/openmw/mwworld/livecellref.cpp +++ b/apps/openmw/mwworld/livecellref.cpp @@ -3,8 +3,12 @@ #include +#include "../mwbase/environment.hpp" +#include "../mwbase/world.hpp" + #include "ptr.hpp" #include "class.hpp" +#include "esmstore.hpp" void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state) { @@ -14,7 +18,13 @@ void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state) Ptr ptr (this); if (state.mHasLocals) - mData.setLocals (state.mLocals, mClass->getScript (ptr)); + { + std::string scriptId = mClass->getScript (ptr); + + mData.setLocals (*MWBase::Environment::get().getWorld()->getStore(). + get().search (scriptId)); + mData.getLocals().read (state.mLocals, scriptId); + } mClass->readAdditionalState (ptr, state); } diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index 907204739..008782130 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -152,12 +152,6 @@ namespace MWWorld } } - void RefData::setLocals (const ESM::Locals& locals, const std::string& scriptId) - { - mHasLocals = true; - mLocals.read (locals, scriptId); - } - void RefData::setCount (int count) { if(count == 0) diff --git a/apps/openmw/mwworld/refdata.hpp b/apps/openmw/mwworld/refdata.hpp index a74eb838c..82371b056 100644 --- a/apps/openmw/mwworld/refdata.hpp +++ b/apps/openmw/mwworld/refdata.hpp @@ -83,8 +83,6 @@ namespace MWWorld void setLocals (const ESM::Script& script); - void setLocals (const ESM::Locals& locals, const std::string& scriptId); - void setCount (int count); /// Set object count (an object pile is a simple object with a count >1). ///