mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 01:39:40 +00:00
Reset RefNum when copying an object (Fixes #1723)
This commit is contained in:
parent
1a6db097ed
commit
9e48d56244
4 changed files with 11 additions and 0 deletions
|
@ -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…
Reference in a new issue