Reset RefNum when copying an object (Fixes #1723)

pull/196/head
scrawl 11 years ago
parent 1a6db097ed
commit 9e48d56244

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

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

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

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

Loading…
Cancel
Save