1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 19:21:04 +00:00

Quick solution to add logic to getNextRef() calls so that moved references are ignored. Currently it is assumed that MVRF records have been all read before the ESM reader context was saved, which is false assumption. Should resolve Issue #6139.

This commit is contained in:
cc9cii 2021-07-07 08:18:38 +10:00
parent 47218d1cba
commit 16e1398819
2 changed files with 18 additions and 2 deletions

View File

@ -423,9 +423,17 @@ namespace MWRender
cell->restore(esm[index], i);
ESM::CellRef ref;
ref.mRefNum.mContentFile = ESM::RefNum::RefNum_NoContentFile;
ESM::MovedCellRef cMRef;
cMRef.mRefNum.mIndex = 0;
bool deleted = false;
while(cell->getNextRef(esm[index], ref, deleted))
while(cell->getNextRef(esm[index], ref, deleted, /*ignoreMoves*/true, &cMRef))
{
if (cMRef.mRefNum.mIndex)
{
cMRef.mRefNum.mIndex = 0;
continue; // ignore refs that are moved
}
if (std::find(cell->mMovedRefs.begin(), cell->mMovedRefs.end(), ref.mRefNum) != cell->mMovedRefs.end()) continue;
Misc::StringUtils::lowerCaseInPlace(ref.mRefID);
int type = store.findStatic(ref.mRefID);

View File

@ -553,12 +553,20 @@ namespace MWWorld
ESM::CellRef ref;
// Get each reference in turn
ESM::MovedCellRef cMRef;
cMRef.mRefNum.mIndex = 0;
bool deleted = false;
while (mCell->getNextRef (esm[index], ref, deleted))
while(mCell->getNextRef(esm[index], ref, deleted, /*ignoreMoves*/true, &cMRef))
{
if (deleted)
continue;
if (cMRef.mRefNum.mIndex)
{
cMRef.mRefNum.mIndex = 0;
continue; // ignore refs that are moved
}
// Don't list reference if it was moved to a different cell.
ESM::MovedCellRefTracker::const_iterator iter =
std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum);