diff --git a/apps/opencs/model/tools/birthsigncheck.cpp b/apps/opencs/model/tools/birthsigncheck.cpp index c582da8e4b..a0ae4b11f1 100644 --- a/apps/opencs/model/tools/birthsigncheck.cpp +++ b/apps/opencs/model/tools/birthsigncheck.cpp @@ -7,17 +7,6 @@ #include "../world/universalid.hpp" - -std::string CSMTools::BirthsignCheckStage::checkTexture(const std::string &texture) const -{ - if (mTextures.searchId(texture) != -1) return std::string(); - - std::string ddsTexture = texture; - if (Misc::ResourceHelpers::changeExtensionToDds(ddsTexture) && mTextures.searchId(ddsTexture) != -1) return std::string(); - - return "Image '" + texture + "' does not exist"; -} - CSMTools::BirthsignCheckStage::BirthsignCheckStage (const CSMWorld::IdCollection& birthsigns, const CSMWorld::Resources &textures) : mBirthsigns(birthsigns), @@ -46,24 +35,21 @@ void CSMTools::BirthsignCheckStage::perform (int stage, CSMDoc::Messages& messag CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Birthsign, birthsign.mId); if (birthsign.mName.empty()) - { messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error); - } if (birthsign.mDescription.empty()) - { messages.add(id, "Description is missing", "", CSMDoc::Message::Severity_Warning); - } if (birthsign.mTexture.empty()) - { messages.add(id, "Image is missing", "", CSMDoc::Message::Severity_Error); - } else { - const std::string error = checkTexture(birthsign.mTexture); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); + if (mTextures.searchId(birthsign.mTexture) != -1) + return; + + std::string ddsTexture = birthsign.mTexture; + if (!(Misc::ResourceHelpers::changeExtensionToDds(ddsTexture) && mTextures.searchId(ddsTexture) != -1)) + messages.add(id, "Image '" + birthsign.mTexture + "' does not exist", "", CSMDoc::Message::Severity_Error); } /// \todo check data members that can't be edited in the table view diff --git a/apps/opencs/model/tools/birthsigncheck.hpp b/apps/opencs/model/tools/birthsigncheck.hpp index d032d3cefd..9001c524cd 100644 --- a/apps/opencs/model/tools/birthsigncheck.hpp +++ b/apps/opencs/model/tools/birthsigncheck.hpp @@ -17,9 +17,6 @@ namespace CSMTools const CSMWorld::Resources &mTextures; bool mIgnoreBaseRecords; - private: - std::string checkTexture(const std::string &texture) const; - public: BirthsignCheckStage (const CSMWorld::IdCollection &birthsigns, diff --git a/apps/opencs/model/tools/classcheck.cpp b/apps/opencs/model/tools/classcheck.cpp index 9984c32872..25cca8fcdf 100644 --- a/apps/opencs/model/tools/classcheck.cpp +++ b/apps/opencs/model/tools/classcheck.cpp @@ -49,12 +49,10 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages) // test for invalid attributes for (int i=0; i<2; ++i) - { if (class_.mData.mAttribute[i]==-1) { messages.add(id, "Attribute #" + std::to_string(i) + " is not set", "", CSMDoc::Message::Severity_Error); } - } if (class_.mData.mAttribute[0]==class_.mData.mAttribute[1] && class_.mData.mAttribute[0]!=-1) { @@ -69,10 +67,8 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages) ++skills[class_.mData.mSkills[i][i2]]; for (auto &skill : skills) - { if (skill.second>1) { messages.add(id, "Skill " + ESM::Skill::indexToId (skill.first) + " is listed more than once", "", CSMDoc::Message::Severity_Warning); } - } } diff --git a/apps/opencs/model/tools/magiceffectcheck.cpp b/apps/opencs/model/tools/magiceffectcheck.cpp index 943d89cdc7..b62e791a43 100644 --- a/apps/opencs/model/tools/magiceffectcheck.cpp +++ b/apps/opencs/model/tools/magiceffectcheck.cpp @@ -4,17 +4,6 @@ #include "../prefs/state.hpp" -std::string CSMTools::MagicEffectCheckStage::checkTexture(const std::string &texture, bool isIcon) const -{ - const CSMWorld::Resources &textures = isIcon ? mIcons : mTextures; - if (textures.searchId(texture) != -1) return std::string(); - - std::string ddsTexture = texture; - if (Misc::ResourceHelpers::changeExtensionToDds(ddsTexture) && textures.searchId(ddsTexture) != -1) return std::string(); - - return (isIcon ? "Icon '" : "Particle '") + texture + "' does not exist"; -} - std::string CSMTools::MagicEffectCheckStage::checkObject(const std::string &id, const CSMWorld::UniversalId &type, const std::string &column) const @@ -25,12 +14,6 @@ std::string CSMTools::MagicEffectCheckStage::checkObject(const std::string &id, return std::string(); } -std::string CSMTools::MagicEffectCheckStage::checkSound(const std::string &id, const std::string &column) const -{ - if (!id.empty() && mSounds.searchId(id) == -1) return (column + " '" + id + "' " + "does not exist"); - return std::string(); -} - CSMTools::MagicEffectCheckStage::MagicEffectCheckStage(const CSMWorld::IdCollection &effects, const CSMWorld::IdCollection &sounds, const CSMWorld::RefIdCollection &objects, @@ -79,16 +62,22 @@ void CSMTools::MagicEffectCheckStage::perform(int stage, CSMDoc::Messages &messa } else { - const std::string error = checkTexture(effect.mIcon, true); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); + if (mIcons.searchId(effect.mIcon) == -1) + { + std::string ddsIcon = effect.mIcon; + if (!(Misc::ResourceHelpers::changeExtensionToDds(ddsIcon) && mIcons.searchId(ddsIcon) != -1)) + messages.add(id, "Icon '" + effect.mIcon + "' does not exist", "", CSMDoc::Message::Severity_Error); + } } if (!effect.mParticle.empty()) { - const std::string error = checkTexture(effect.mParticle, false); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); + if (mTextures.searchId(effect.mParticle) == -1) + { + std::string ddsParticle = effect.mParticle; + if (!(Misc::ResourceHelpers::changeExtensionToDds(ddsParticle) && mTextures.searchId(ddsParticle) != -1)) + messages.add(id, "Particle texture '" + effect.mParticle + "' does not exist", "", CSMDoc::Message::Severity_Error); + } } if (!effect.mCasting.empty()) @@ -119,31 +108,12 @@ void CSMTools::MagicEffectCheckStage::perform(int stage, CSMDoc::Messages &messa messages.add(id, error, "", CSMDoc::Message::Severity_Error); } - if (!effect.mCastSound.empty()) - { - const std::string error = checkSound(effect.mCastSound, "Casting sound"); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); - } - - if (!effect.mHitSound.empty()) - { - const std::string error = checkSound(effect.mHitSound, "Hit sound"); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); - } - - if (!effect.mAreaSound.empty()) - { - const std::string error = checkSound(effect.mAreaSound, "Area sound"); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); - } - - if (!effect.mBoltSound.empty()) - { - const std::string error = checkSound(effect.mBoltSound, "Bolt sound"); - if (!error.empty()) - messages.add(id, error, "", CSMDoc::Message::Severity_Error); - } + if (!effect.mCastSound.empty() && mSounds.searchId(effect.mCastSound) == -1) + messages.add(id, "Casting sound '" + effect.mCastSound + "' does not exist", "", CSMDoc::Message::Severity_Error); + if (!effect.mHitSound.empty() && mSounds.searchId(effect.mHitSound) == -1) + messages.add(id, "Hit sound '" + effect.mHitSound + "' does not exist", "", CSMDoc::Message::Severity_Error); + if (!effect.mAreaSound.empty() && mSounds.searchId(effect.mAreaSound) == -1) + messages.add(id, "Area sound '" + effect.mAreaSound + "' does not exist", "", CSMDoc::Message::Severity_Error); + if (!effect.mBoltSound.empty() && mSounds.searchId(effect.mBoltSound) == -1) + messages.add(id, "Bolt sound '" + effect.mBoltSound + "' does not exist", "", CSMDoc::Message::Severity_Error); } diff --git a/apps/opencs/model/tools/referenceablecheck.cpp b/apps/opencs/model/tools/referenceablecheck.cpp index 60d4a6b589..4d68c93cde 100644 --- a/apps/opencs/model/tools/referenceablecheck.cpp +++ b/apps/opencs/model/tools/referenceablecheck.cpp @@ -723,7 +723,9 @@ void CSMTools::ReferenceableCheckStage::npcCheck ( messages.add(id, "Disposition is negative", "", CSMDoc::Message::Severity_Warning); if (reputation < 0) + { messages.add(id, "Reputation is negative", "", CSMDoc::Message::Severity_Warning); + } if (!npc.mFaction.empty()) {