From d3c1928f0118e67551567e906ae1dcc801bf72db Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 9 Jul 2023 15:24:52 +0200 Subject: [PATCH] Fix dialogue insertion again --- components/esm3/infoorder.hpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/components/esm3/infoorder.hpp b/components/esm3/infoorder.hpp index 77b80e3d20..154cf8970f 100644 --- a/components/esm3/infoorder.hpp +++ b/components/esm3/infoorder.hpp @@ -24,14 +24,15 @@ namespace ESM auto it = mInfoPositions.find(value.mId); - if (it != mInfoPositions.end() && it->second.mPosition->mPrev == value.mPrev) + if (it != mInfoPositions.end()) { + bool samePrev = it->second.mPosition->mPrev == value.mPrev; *it->second.mPosition = std::forward(value); it->second.mDeleted = deleted; - return; + if (samePrev) + return; } - - if (it == mInfoPositions.end()) + else it = mInfoPositions.emplace(value.mId, Item{ .mPosition = mOrderedInfo.end(), .mDeleted = deleted }) .first; @@ -57,13 +58,6 @@ namespace ESM return; } - const auto nextIt = mInfoPositions.find(value.mNext); - if (nextIt != mInfoPositions.end()) - { - insertOrSplice(nextIt->second.mPosition); - return; - } - insertOrSplice(mOrderedInfo.end()); }