mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 06:06:39 +00:00
Fix(CS): Correct invalid refNum for cloned objects so they actually
appear ingame
This commit is contained in:
parent
2a747529bb
commit
2bb8ceef56
1 changed files with 10 additions and 0 deletions
|
@ -297,6 +297,7 @@ void CSMWorld::RefCollection::cloneRecord(
|
|||
const ESM::RefId& origin, const ESM::RefId& destination, const UniversalId::Type type)
|
||||
{
|
||||
auto copy = std::make_unique<Record<CellRef>>();
|
||||
int index = getAppendIndex(ESM::RefId(), type);
|
||||
|
||||
copy->mModified = getRecord(origin).get();
|
||||
copy->mState = RecordBase::State_ModifiedOnly;
|
||||
|
@ -304,6 +305,15 @@ void CSMWorld::RefCollection::cloneRecord(
|
|||
copy->get().mId = destination;
|
||||
copy->get().mIdNum = extractIdNum(destination.getRefIdString());
|
||||
|
||||
if (copy->get().mRefNum.mContentFile != 0)
|
||||
{
|
||||
mRefIndex.insert(std::make_pair(static_cast<Record<CellRef>*>(copy.get())->get().mIdNum, index));
|
||||
copy->get().mRefNum.mContentFile = 0;
|
||||
copy->get().mRefNum.mIndex = index;
|
||||
}
|
||||
else
|
||||
copy->get().mRefNum.mIndex = copy->get().mIdNum;
|
||||
|
||||
insertRecord(std::move(copy), getAppendIndex(destination, type)); // call RefCollection::insertRecord()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue