#include "startscriptcheck.hpp" #include #include "../prefs/state.hpp" #include #include #include #include #include #include #include #include namespace ESM { class Script; } CSMTools::StartScriptCheckStage::StartScriptCheckStage( const CSMWorld::IdCollection& startScripts, const CSMWorld::IdCollection& scripts) : mStartScripts(startScripts) , mScripts(scripts) { mIgnoreBaseRecords = false; } void CSMTools::StartScriptCheckStage::perform(int stage, CSMDoc::Messages& messages) { const CSMWorld::Record& record = mStartScripts.getRecord(stage); // Skip "Base" records (setting!) and "Deleted" records if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted()) return; const auto& scriptId = record.get().mId; CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_StartScript, scriptId); if (mScripts.searchId(scriptId) == -1) messages.add( id, "Start script " + scriptId.getRefIdString() + " does not exist", "", CSMDoc::Message::Severity_Error); } int CSMTools::StartScriptCheckStage::setup() { mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue(); return mStartScripts.getSize(); }