From aec4e02417cef6106b78ffa5978c6279c32abdd0 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 12 Jul 2021 18:20:51 +0200 Subject: [PATCH] Ignore only CellRefs with preceding MVRF subrecord MVRF subrecord means that only single following FRMR subrecord is moved not the rest of subrecords. --- components/esm/loadcell.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index e90af7b2f6..562e8f643a 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -232,13 +232,18 @@ namespace ESM if (!esm.hasMoreSubs()) return false; - // NOTE: We should not need this check. It is a safety check until we have checked - // more plugins, and how they treat these moved references. - if (esm.isNextSub("MVRF")) + // MVRF are FRMR are present in pairs. MVRF indicates that following FRMR describes moved CellRef. + // This function has to skip all moved CellRefs therefore read all such pairs to ignored values. + while (esm.isNextSub("MVRF")) { - // skip rest of cell record (moved references), they are handled elsewhere - esm.skipRecord(); // skip MVRF, CNDT - return false; + MovedCellRef movedCellRef; + esm.getHT(movedCellRef.mRefNum.mIndex); + esm.getHNOT(movedCellRef.mTarget, "CNDT"); + CellRef skippedCellRef; + if (!esm.peekNextSub("FRMR")) + return false; + bool skippedDeleted; + skippedCellRef.load(esm, skippedDeleted); } if (esm.peekNextSub("FRMR"))