diff --git a/apps/openmw/mwworld/cellref.cpp b/apps/openmw/mwworld/cellref.cpp index cdf08e6ed..c0b3bb6af 100644 --- a/apps/openmw/mwworld/cellref.cpp +++ b/apps/openmw/mwworld/cellref.cpp @@ -10,6 +10,12 @@ namespace MWWorld return mCellRef.mRefNum; } + void CellRef::unsetRefNum() + { + mCellRef.mRefNum.mContentFile = -1; + mCellRef.mRefNum.mIndex = 0; + } + std::string CellRef::getRefId() const { return mCellRef.mRefID; diff --git a/apps/openmw/mwworld/cellref.hpp b/apps/openmw/mwworld/cellref.hpp index 577655739..d2e4fdf1c 100644 --- a/apps/openmw/mwworld/cellref.hpp +++ b/apps/openmw/mwworld/cellref.hpp @@ -25,6 +25,9 @@ namespace MWWorld // Note: Currently unused for items in containers ESM::RefNum getRefNum() const; + // Set RefNum to its default state. + void unsetRefNum(); + // Id of object being referenced std::string getRefId() const; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 18ebd82db..3188c1cd5 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -255,6 +255,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr pos.pos[1] = 0; pos.pos[2] = 0; item.getCellRef().setPosition(pos); + item.getCellRef().unsetRefNum(); // destroy link to content file std::string script = item.getClass().getScript(item); if(script != "") diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index ebbc16c23..d1207dd8b 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1718,6 +1718,7 @@ namespace MWWorld localRotation.rot[2] = 0; dropped.getRefData().setLocalRotation(localRotation); dropped.getCellRef().setPosition(pos); + dropped.getCellRef().unsetRefNum(); if (mWorldScene->isCellActive(*cell)) { if (dropped.getRefData().isEnabled()) {