1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00

Reset RefNum when copying an object (Fixes #1723)

This commit is contained in:
scrawl 2014-07-29 15:55:58 +02:00
parent 1a6db097ed
commit 9e48d56244
4 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 != "")

View File

@ -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()) {