From fb4250a2b726bb7ca27315c2924c0015e95a9944 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Mon, 19 Oct 2020 15:02:10 +0300 Subject: [PATCH 1/2] Strip the plugin index when looking for deleted refs. --- apps/opencs/model/world/refcollection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/world/refcollection.cpp b/apps/opencs/model/world/refcollection.cpp index 1d91bbd59..344cf1bb5 100644 --- a/apps/opencs/model/world/refcollection.cpp +++ b/apps/opencs/model/world/refcollection.cpp @@ -64,9 +64,10 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool // ignore content file number std::map::iterator iter = cache.begin(); + unsigned int thisIndex = ref.mRefNum.mIndex & 0x00ffffff; for (; iter != cache.end(); ++iter) { - if (ref.mRefNum.mIndex == iter->first.mIndex) + if (thisIndex == iter->first.mIndex) break; } From b1ea9f6a5b9bc54e11ef47bfd1fe7bd9daa92af1 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Fri, 23 Oct 2020 20:21:34 +0300 Subject: [PATCH 2/2] Strip the plugin index from refid completely --- apps/opencs/model/world/refcollection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/world/refcollection.cpp b/apps/opencs/model/world/refcollection.cpp index 344cf1bb5..d8f6b391b 100644 --- a/apps/opencs/model/world/refcollection.cpp +++ b/apps/opencs/model/world/refcollection.cpp @@ -64,10 +64,10 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool // ignore content file number std::map::iterator iter = cache.begin(); - unsigned int thisIndex = ref.mRefNum.mIndex & 0x00ffffff; + ref.mRefNum.mIndex = ref.mRefNum.mIndex & 0x00ffffff; for (; iter != cache.end(); ++iter) { - if (thisIndex == iter->first.mIndex) + if (ref.mRefNum.mIndex == iter->first.mIndex) break; }