From 48bbf0b637dc5ad001ee9e989a03e06cbc6a7200 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Fri, 26 Jan 2024 19:09:52 +0300 Subject: [PATCH] Editor: Don't complain about body part references in Verify --- apps/opencs/model/tools/referencecheck.cpp | 8 ++++++-- apps/opencs/model/tools/referencecheck.hpp | 5 ++++- apps/opencs/model/tools/tools.cpp | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/opencs/model/tools/referencecheck.cpp b/apps/opencs/model/tools/referencecheck.cpp index 511458b946..33c2168ef3 100644 --- a/apps/opencs/model/tools/referencecheck.cpp +++ b/apps/opencs/model/tools/referencecheck.cpp @@ -18,16 +18,18 @@ #include #include +#include #include CSMTools::ReferenceCheckStage::ReferenceCheckStage(const CSMWorld::RefCollection& references, const CSMWorld::RefIdCollection& referencables, const CSMWorld::IdCollection& cells, - const CSMWorld::IdCollection& factions) + const CSMWorld::IdCollection& factions, const CSMWorld::IdCollection& bodyparts) : mReferences(references) , mObjects(referencables) , mDataSet(referencables.getDataSet()) , mCells(cells) , mFactions(factions) + , mBodyParts(bodyparts) { mIgnoreBaseRecords = false; } @@ -49,9 +51,11 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages& message else { // Check for non existing referenced object - if (mObjects.searchId(cellRef.mRefID) == -1) + if (mObjects.searchId(cellRef.mRefID) == -1 && mBodyParts.searchId(cellRef.mRefID) == -1) + { messages.add(id, "Instance of a non-existent object '" + cellRef.mRefID.getRefIdString() + "'", "", CSMDoc::Message::Severity_Error); + } else { // Check if reference charge is valid for it's proper referenced type diff --git a/apps/opencs/model/tools/referencecheck.hpp b/apps/opencs/model/tools/referencecheck.hpp index 04cca2b803..5f5004b912 100644 --- a/apps/opencs/model/tools/referencecheck.hpp +++ b/apps/opencs/model/tools/referencecheck.hpp @@ -8,6 +8,7 @@ namespace ESM { + struct BodyPart; struct Faction; } @@ -29,7 +30,8 @@ namespace CSMTools { public: ReferenceCheckStage(const CSMWorld::RefCollection& references, const CSMWorld::RefIdCollection& referencables, - const CSMWorld::IdCollection& cells, const CSMWorld::IdCollection& factions); + const CSMWorld::IdCollection& cells, const CSMWorld::IdCollection& factions, + const CSMWorld::IdCollection& bodyparts); void perform(int stage, CSMDoc::Messages& messages) override; int setup() override; @@ -40,6 +42,7 @@ namespace CSMTools const CSMWorld::RefIdData& mDataSet; const CSMWorld::IdCollection& mCells; const CSMWorld::IdCollection& mFactions; + const CSMWorld::IdCollection& mBodyParts; bool mIgnoreBaseRecords; }; } diff --git a/apps/opencs/model/tools/tools.cpp b/apps/opencs/model/tools/tools.cpp index e1e7a0dcd8..04548ca4cf 100644 --- a/apps/opencs/model/tools/tools.cpp +++ b/apps/opencs/model/tools/tools.cpp @@ -105,8 +105,8 @@ CSMDoc::OperationHolder* CSMTools::Tools::getVerifier() mData.getFactions(), mData.getScripts(), mData.getResources(CSMWorld::UniversalId::Type_Meshes), mData.getResources(CSMWorld::UniversalId::Type_Icons), mData.getBodyParts())); - mVerifierOperation->appendStage(new ReferenceCheckStage( - mData.getReferences(), mData.getReferenceables(), mData.getCells(), mData.getFactions())); + mVerifierOperation->appendStage(new ReferenceCheckStage(mData.getReferences(), mData.getReferenceables(), + mData.getCells(), mData.getFactions(), mData.getBodyParts())); mVerifierOperation->appendStage(new ScriptCheckStage(mDocument));