pull/541/head
Capostrophic 6 years ago
parent 34ffaa2fe2
commit 0bdb7ea92f

@ -7,17 +7,6 @@
#include "../world/universalid.hpp" #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, CSMTools::BirthsignCheckStage::BirthsignCheckStage (const CSMWorld::IdCollection<ESM::BirthSign>& birthsigns,
const CSMWorld::Resources &textures) const CSMWorld::Resources &textures)
: mBirthsigns(birthsigns), : mBirthsigns(birthsigns),
@ -46,24 +35,21 @@ void CSMTools::BirthsignCheckStage::perform (int stage, CSMDoc::Messages& messag
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Birthsign, birthsign.mId); CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Birthsign, birthsign.mId);
if (birthsign.mName.empty()) if (birthsign.mName.empty())
{
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error); messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
}
if (birthsign.mDescription.empty()) if (birthsign.mDescription.empty())
{
messages.add(id, "Description is missing", "", CSMDoc::Message::Severity_Warning); messages.add(id, "Description is missing", "", CSMDoc::Message::Severity_Warning);
}
if (birthsign.mTexture.empty()) if (birthsign.mTexture.empty())
{
messages.add(id, "Image is missing", "", CSMDoc::Message::Severity_Error); messages.add(id, "Image is missing", "", CSMDoc::Message::Severity_Error);
}
else else
{ {
const std::string error = checkTexture(birthsign.mTexture); if (mTextures.searchId(birthsign.mTexture) != -1)
if (!error.empty()) return;
messages.add(id, error, "", CSMDoc::Message::Severity_Error);
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 /// \todo check data members that can't be edited in the table view

@ -17,9 +17,6 @@ namespace CSMTools
const CSMWorld::Resources &mTextures; const CSMWorld::Resources &mTextures;
bool mIgnoreBaseRecords; bool mIgnoreBaseRecords;
private:
std::string checkTexture(const std::string &texture) const;
public: public:
BirthsignCheckStage (const CSMWorld::IdCollection<ESM::BirthSign> &birthsigns, BirthsignCheckStage (const CSMWorld::IdCollection<ESM::BirthSign> &birthsigns,

@ -49,12 +49,10 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages)
// test for invalid attributes // test for invalid attributes
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
{
if (class_.mData.mAttribute[i]==-1) if (class_.mData.mAttribute[i]==-1)
{ {
messages.add(id, "Attribute #" + std::to_string(i) + " is not set", "", CSMDoc::Message::Severity_Error); 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) 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]]; ++skills[class_.mData.mSkills[i][i2]];
for (auto &skill : skills) for (auto &skill : skills)
{
if (skill.second>1) if (skill.second>1)
{ {
messages.add(id, "Skill " + ESM::Skill::indexToId (skill.first) + " is listed more than once", "", CSMDoc::Message::Severity_Warning); 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" #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, std::string CSMTools::MagicEffectCheckStage::checkObject(const std::string &id,
const CSMWorld::UniversalId &type, const CSMWorld::UniversalId &type,
const std::string &column) const const std::string &column) const
@ -25,12 +14,6 @@ std::string CSMTools::MagicEffectCheckStage::checkObject(const std::string &id,
return std::string(); 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, CSMTools::MagicEffectCheckStage::MagicEffectCheckStage(const CSMWorld::IdCollection<ESM::MagicEffect> &effects,
const CSMWorld::IdCollection<ESM::Sound> &sounds, const CSMWorld::IdCollection<ESM::Sound> &sounds,
const CSMWorld::RefIdCollection &objects, const CSMWorld::RefIdCollection &objects,
@ -79,16 +62,22 @@ void CSMTools::MagicEffectCheckStage::perform(int stage, CSMDoc::Messages &messa
} }
else else
{ {
const std::string error = checkTexture(effect.mIcon, true); if (mIcons.searchId(effect.mIcon) == -1)
if (!error.empty()) {
messages.add(id, error, "", CSMDoc::Message::Severity_Error); 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()) if (!effect.mParticle.empty())
{ {
const std::string error = checkTexture(effect.mParticle, false); if (mTextures.searchId(effect.mParticle) == -1)
if (!error.empty()) {
messages.add(id, error, "", CSMDoc::Message::Severity_Error); 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()) 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); messages.add(id, error, "", CSMDoc::Message::Severity_Error);
} }
if (!effect.mCastSound.empty()) if (!effect.mCastSound.empty() && mSounds.searchId(effect.mCastSound) == -1)
{ messages.add(id, "Casting sound '" + effect.mCastSound + "' does not exist", "", CSMDoc::Message::Severity_Error);
const std::string error = checkSound(effect.mCastSound, "Casting sound"); if (!effect.mHitSound.empty() && mSounds.searchId(effect.mHitSound) == -1)
if (!error.empty()) messages.add(id, "Hit sound '" + effect.mHitSound + "' does not exist", "", CSMDoc::Message::Severity_Error);
messages.add(id, error, "", 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)
if (!effect.mHitSound.empty()) messages.add(id, "Bolt sound '" + effect.mBoltSound + "' does not exist", "", CSMDoc::Message::Severity_Error);
{
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);
}
} }

@ -723,7 +723,9 @@ void CSMTools::ReferenceableCheckStage::npcCheck (
messages.add(id, "Disposition is negative", "", CSMDoc::Message::Severity_Warning); messages.add(id, "Disposition is negative", "", CSMDoc::Message::Severity_Warning);
if (reputation < 0) if (reputation < 0)
{
messages.add(id, "Reputation is negative", "", CSMDoc::Message::Severity_Warning); messages.add(id, "Reputation is negative", "", CSMDoc::Message::Severity_Warning);
}
if (!npc.mFaction.empty()) if (!npc.mFaction.empty())
{ {

Loading…
Cancel
Save