From ed5bedb9db145e271b0f5d1f414066f9e02cb8d4 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Wed, 22 May 2024 22:16:23 +0200 Subject: [PATCH] Use record state to determine if a LandTexture record was defined in the current plugin --- apps/opencs/model/world/idtable.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/opencs/model/world/idtable.cpp b/apps/opencs/model/world/idtable.cpp index 69ac8a42b6..8409402dd3 100644 --- a/apps/opencs/model/world/idtable.cpp +++ b/apps/opencs/model/world/idtable.cpp @@ -384,15 +384,20 @@ CSMWorld::LandTextureIdTable::ImportResults CSMWorld::LandTextureIdTable::import const ESM::RefId refId = ESM::RefId::stringRefId(id); const int oldRow = idCollection()->searchId(refId); - // If it does not exist or it is in the current plugin, it can be skipped. - if (oldRow < 0 || plugin == 0) + // If it does not exist, it can be skipped. + if (oldRow < 0) { results.recordMapping.emplace_back(id, id); continue; } - // Look for a pre-existing record auto& record = static_cast&>(idCollection()->getRecord(oldRow)); + // If it is in the current plugin, it can be skipped. + if (record.mState == Record::State_ModifiedOnly) + { + results.recordMapping.emplace_back(id, id); + continue; + } std::string texture = Misc::StringUtils::lowerCase(record.get().mTexture); auto searchIt = reverseLookupMap.find(texture); if (searchIt != reverseLookupMap.end())