1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 11:39:41 +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; return mCellRef.mRefNum;
} }
void CellRef::unsetRefNum()
{
mCellRef.mRefNum.mContentFile = -1;
mCellRef.mRefNum.mIndex = 0;
}
std::string CellRef::getRefId() const std::string CellRef::getRefId() const
{ {
return mCellRef.mRefID; return mCellRef.mRefID;

View file

@ -25,6 +25,9 @@ namespace MWWorld
// Note: Currently unused for items in containers // Note: Currently unused for items in containers
ESM::RefNum getRefNum() const; ESM::RefNum getRefNum() const;
// Set RefNum to its default state.
void unsetRefNum();
// Id of object being referenced // Id of object being referenced
std::string getRefId() const; std::string getRefId() const;

View file

@ -255,6 +255,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
pos.pos[1] = 0; pos.pos[1] = 0;
pos.pos[2] = 0; pos.pos[2] = 0;
item.getCellRef().setPosition(pos); item.getCellRef().setPosition(pos);
item.getCellRef().unsetRefNum(); // destroy link to content file
std::string script = item.getClass().getScript(item); std::string script = item.getClass().getScript(item);
if(script != "") if(script != "")

View file

@ -1718,6 +1718,7 @@ namespace MWWorld
localRotation.rot[2] = 0; localRotation.rot[2] = 0;
dropped.getRefData().setLocalRotation(localRotation); dropped.getRefData().setLocalRotation(localRotation);
dropped.getCellRef().setPosition(pos); dropped.getCellRef().setPosition(pos);
dropped.getCellRef().unsetRefNum();
if (mWorldScene->isCellActive(*cell)) { if (mWorldScene->isCellActive(*cell)) {
if (dropped.getRefData().isEnabled()) { if (dropped.getRefData().isEnabled()) {