Commit 35281d7c authored by Capostrophic's avatar Capostrophic

Use Messages::add in race, soundgen, spell and start script record verifiers

parent b2b9bd94
......@@ -28,25 +28,27 @@ void CSMTools::RaceCheckStage::performPerRecord (int stage, CSMDoc::Messages& me
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Race, race.mId);
// test for empty name and description
if (race.mName.empty())
messages.push_back (std::make_pair (id, "Name is missing"));
if (race.mName.empty() && race.mData.mFlags & 0x1)
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
else if (race.mName.empty())
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Warning);
if (race.mDescription.empty())
messages.push_back (std::make_pair (id, "Description is missing"));
messages.add(id, "Description is missing", "", CSMDoc::Message::Severity_Warning);
// test for positive height
if (race.mData.mHeight.mMale<=0)
messages.push_back (std::make_pair (id, "Male height is non-positive"));
messages.add(id, "Male height is non-positive", "", CSMDoc::Message::Severity_Error);
if (race.mData.mHeight.mFemale<=0)
messages.push_back (std::make_pair (id, "Female height is non-positive"));
messages.add(id, "Female height is non-positive", "", CSMDoc::Message::Severity_Error);
// test for non-negative weight
if (race.mData.mWeight.mMale<0)
messages.push_back (std::make_pair (id, "Male weight is negative"));
messages.add(id, "Male weight is negative", "", CSMDoc::Message::Severity_Error);
if (race.mData.mWeight.mFemale<0)
messages.push_back (std::make_pair (id, "Female weight is negative"));
messages.add(id, "Female weight is negative", "", CSMDoc::Message::Severity_Error);
/// \todo check data members that can't be edited in the table view
}
......@@ -56,7 +58,7 @@ void CSMTools::RaceCheckStage::performFinal (CSMDoc::Messages& messages)
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Races);
if (!mPlayable)
messages.push_back (std::make_pair (id, "No playable race"));
messages.add(id, "No playable race", "", CSMDoc::Message::Severity_SeriousError);
}
CSMTools::RaceCheckStage::RaceCheckStage (const CSMWorld::IdCollection<ESM::Race>& races)
......
......@@ -40,20 +40,20 @@ void CSMTools::SoundGenCheckStage::perform(int stage, CSMDoc::Messages &messages
CSMWorld::RefIdData::LocalIndex creatureIndex = mObjects.getDataSet().searchId(soundGen.mCreature);
if (creatureIndex.first == -1)
{
messages.push_back(std::make_pair(id, "Creature '" + soundGen.mCreature + "' doesn't exist"));
messages.add(id, "Creature '" + soundGen.mCreature + "' doesn't exist", "", CSMDoc::Message::Severity_Error);
}
else if (creatureIndex.second != CSMWorld::UniversalId::Type_Creature)
{
messages.push_back(std::make_pair(id, "'" + soundGen.mCreature + "' is not a creature"));
messages.add(id, "'" + soundGen.mCreature + "' is not a creature", "", CSMDoc::Message::Severity_Error);
}
}
if (soundGen.mSound.empty())
{
messages.push_back(std::make_pair(id, "Sound is missing"));
messages.add(id, "Sound is missing", "", CSMDoc::Message::Severity_Error);
}
else if (mSounds.searchId(soundGen.mSound) == -1)
{
messages.push_back(std::make_pair(id, "Sound '" + soundGen.mSound + "' doesn't exist"));
messages.add(id, "Sound '" + soundGen.mSound + "' doesn't exist", "", CSMDoc::Message::Severity_Error);
}
}
......@@ -34,13 +34,13 @@ void CSMTools::SpellCheckStage::perform (int stage, CSMDoc::Messages& messages)
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Spell, spell.mId);
// test for empty name and description
// test for empty name
if (spell.mName.empty())
messages.push_back (std::make_pair (id, "Name is missing"));
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
// test for invalid cost values
if (spell.mData.mCost<0)
messages.push_back (std::make_pair (id, "Spell cost is negative"));
messages.add(id, "Spell cost is negative", "", CSMDoc::Message::Severity_Error);
/// \todo check data members that can't be edited in the table view
}
......@@ -25,7 +25,7 @@ void CSMTools::StartScriptCheckStage::perform(int stage, CSMDoc::Messages& messa
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_StartScript, scriptId);
if (mScripts.searchId (Misc::StringUtils::lowerCase (scriptId))==-1)
messages.push_back (std::make_pair (id, "Start script " + scriptId + " does not exist"));
messages.add(id, "Start script " + scriptId + " does not exist", "", CSMDoc::Message::Severity_Error);
}
int CSMTools::StartScriptCheckStage::setup()
......
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