Commit 0bdb7ea9 authored by Capostrophic's avatar Capostrophic

Cleanup

parent 34ffaa2f
......@@ -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<ESM::BirthSign>& 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
......
......@@ -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<ESM::BirthSign> &birthsigns,
......
......@@ -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);
}
}
}
......@@ -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<ESM::MagicEffect> &effects,
const CSMWorld::IdCollection<ESM::Sound> &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);
}
......@@ -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())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment