From dffa8c6c149d1c90e9acde23a27d25d689fa38a7 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 30 Nov 2014 22:02:25 +0100 Subject: [PATCH] Re-insert existing DialInfo records when they are modified by another content file (Fixes #2170) --- components/esm/loaddial.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/components/esm/loaddial.cpp b/components/esm/loaddial.cpp index ff0362aa2..f2da8f377 100644 --- a/components/esm/loaddial.cpp +++ b/components/esm/loaddial.cpp @@ -63,6 +63,8 @@ void Dialogue::readInfo(ESMReader &esm, bool merge) std::map::iterator lookup; lookup = mLookup.find(id); + + ESM::DialInfo info; if (lookup != mLookup.end()) { it = lookup->second; @@ -70,13 +72,17 @@ void Dialogue::readInfo(ESMReader &esm, bool merge) // Merge with existing record. Only the subrecords that are present in // the new record will be overwritten. it->load(esm); - return; - } + info = *it; - // New record - ESM::DialInfo info; - info.mId = id; - info.load(esm); + // Since the record merging may have changed the next/prev linked list connection, we need to re-insert the record + mInfo.erase(it); + mLookup.erase(lookup); + } + else + { + info.mId = id; + info.load(esm); + } if (info.mNext.empty()) {