mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 19:21:04 +00:00
Merge branch 'openmw-cs-error-verify-refnums' into 'master'
OpenMW-CS verify duplicate RefNums See merge request OpenMW/openmw!4012
This commit is contained in:
commit
64dd6e36d1
@ -45,6 +45,16 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages& message
|
|||||||
const CSMWorld::CellRef& cellRef = record.get();
|
const CSMWorld::CellRef& cellRef = record.get();
|
||||||
const CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Reference, cellRef.mId);
|
const CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Reference, cellRef.mId);
|
||||||
|
|
||||||
|
// Check RefNum is unique per content file, otherwise can cause load issues
|
||||||
|
const auto refNum = cellRef.mRefNum;
|
||||||
|
const auto insertResult = mUsedReferenceIDs.emplace(refNum, cellRef.mId);
|
||||||
|
if (!insertResult.second)
|
||||||
|
messages.add(id,
|
||||||
|
"Duplicate RefNum: " + std::to_string(refNum.mContentFile) + std::string("-")
|
||||||
|
+ std::to_string(refNum.mIndex) + " shared with cell reference "
|
||||||
|
+ insertResult.first->second.toString(),
|
||||||
|
"", CSMDoc::Message::Severity_Error);
|
||||||
|
|
||||||
// Check reference id
|
// Check reference id
|
||||||
if (cellRef.mRefID.empty())
|
if (cellRef.mRefID.empty())
|
||||||
messages.add(id, "Instance is not based on an object", "", CSMDoc::Message::Severity_Error);
|
messages.add(id, "Instance is not based on an object", "", CSMDoc::Message::Severity_Error);
|
||||||
@ -109,6 +119,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages& message
|
|||||||
int CSMTools::ReferenceCheckStage::setup()
|
int CSMTools::ReferenceCheckStage::setup()
|
||||||
{
|
{
|
||||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||||
|
mUsedReferenceIDs.clear();
|
||||||
|
|
||||||
return mReferences.getSize();
|
return mReferences.getSize();
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ namespace CSMTools
|
|||||||
const CSMWorld::IdCollection<CSMWorld::Cell>& mCells;
|
const CSMWorld::IdCollection<CSMWorld::Cell>& mCells;
|
||||||
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
||||||
const CSMWorld::IdCollection<ESM::BodyPart>& mBodyParts;
|
const CSMWorld::IdCollection<ESM::BodyPart>& mBodyParts;
|
||||||
|
std::unordered_map<ESM::RefNum, ESM::RefId> mUsedReferenceIDs;
|
||||||
bool mIgnoreBaseRecords;
|
bool mIgnoreBaseRecords;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user