diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 5dd380be05..6337ca440f 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -290,7 +290,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr item.getCellRef().setOwner(""); item.getCellRef().resetGlobalVariable(); item.getCellRef().setFaction(""); - item.getCellRef().setFactionRank(-1); + item.getCellRef().setFactionRank(-2); // must reset the RefNum on the copied item, so that the RefNum on the original item stays unique // maybe we should do this in the copy constructor instead? diff --git a/components/esm/cellref.cpp b/components/esm/cellref.cpp index ba2be7b457..69841528f1 100644 --- a/components/esm/cellref.cpp +++ b/components/esm/cellref.cpp @@ -153,13 +153,19 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool esm.writeHNT("XSCL", scale); } - esm.writeHNOCString("ANAM", mOwner); + if (!inInventory) + esm.writeHNOCString("ANAM", mOwner); + esm.writeHNOCString("BNAM", mGlobalVariable); esm.writeHNOCString("XSOL", mSoul); - esm.writeHNOCString("CNAM", mFaction); - if (mFactionRank != -2) { - esm.writeHNT("INDX", mFactionRank); + if (!inInventory) + { + esm.writeHNOCString("CNAM", mFaction); + if (mFactionRank != -2) + { + esm.writeHNT("INDX", mFactionRank); + } } if (mEnchantmentCharge != -1)