mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 19:39:41 +00:00
Make several messages more strict and clean up topic info verifier
This commit is contained in:
parent
5d1c1f25f7
commit
d6560d3f20
4 changed files with 18 additions and 46 deletions
|
@ -36,12 +36,7 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
|
||||
// A class should have a name
|
||||
if (class_.mName.empty())
|
||||
{
|
||||
if (class_.mData.mIsPlayable != 0)
|
||||
messages.add(id, "Name of a playable class is missing", "", CSMDoc::Message::Severity_Error);
|
||||
else
|
||||
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Warning);
|
||||
}
|
||||
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
|
||||
|
||||
// A playable class should have a description
|
||||
if (class_.mData.mIsPlayable != 0 && class_.mDescription.empty())
|
||||
|
@ -56,7 +51,7 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
|
||||
if (class_.mData.mAttribute[0]==class_.mData.mAttribute[1] && class_.mData.mAttribute[0]!=-1)
|
||||
{
|
||||
messages.add(id, "Same attribute is listed twice", "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, "Same attribute is listed twice", "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
|
||||
// test for non-unique skill
|
||||
|
@ -69,6 +64,6 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
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);
|
||||
messages.add(id, "Skill " + ESM::Skill::indexToId (skill.first) + " is listed more than once", "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ void CSMTools::FactionCheckStage::perform (int stage, CSMDoc::Messages& messages
|
|||
|
||||
// test for empty name
|
||||
if (faction.mName.empty())
|
||||
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, "Name is missing", "", CSMDoc::Message::Severity_Error);
|
||||
|
||||
// test for invalid attributes
|
||||
if (faction.mData.mAttribute[0]==faction.mData.mAttribute[1] && faction.mData.mAttribute[0]!=-1)
|
||||
{
|
||||
messages.add(id, "Same attribute is listed twice", "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, "Same attribute is listed twice", "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
|
||||
// test for non-unique skill
|
||||
|
@ -55,7 +55,7 @@ void CSMTools::FactionCheckStage::perform (int stage, CSMDoc::Messages& messages
|
|||
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);
|
||||
messages.add(id, "Skill " + ESM::Skill::indexToId (skill.first) + " is listed more than once", "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
|
|
|
@ -475,7 +475,7 @@ void CSMTools::ReferenceableCheckStage::creatureCheck (
|
|||
if (creature.mData.mAttack[i] < 0)
|
||||
messages.add(id, "Attack " + std::to_string(i/2 + 1) + " has negative" + (i % 2 == 0 ? " minimum " : " maximum ") + "damage", "", CSMDoc::Message::Severity_Error);
|
||||
if (i % 2 == 0 && creature.mData.mAttack[i] > creature.mData.mAttack[i+1])
|
||||
messages.add(id, "Attack " + std::to_string(i/2 + 1) + " has minimum damage higher than maximum damage", "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, "Attack " + std::to_string(i/2 + 1) + " has minimum damage higher than maximum damage", "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
|
||||
if (creature.mData.mGold < 0)
|
||||
|
|
|
@ -133,7 +133,6 @@ void CSMTools::TopicInfoCheckStage::perform(int stage, CSMDoc::Messages& message
|
|||
|
||||
if (topicInfo.mData.mGender < -1 || topicInfo.mData.mGender > 1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
messages.add(id, "Gender is invalid", "", CSMDoc::Message::Severity_Error);
|
||||
}
|
||||
|
||||
|
@ -170,16 +169,12 @@ bool CSMTools::TopicInfoCheckStage::verifyActor(const std::string& actor, const
|
|||
|
||||
if (index.first == -1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Actor '" << actor << "' does not exist";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, "Actor '" + actor + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
else if (mReferencables.getRecord(index).isDeleted())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Deleted actor '" << actor << "' is being referenced";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, "Deleted actor '" + actor + "' is being referenced", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
else if (index.second != CSMWorld::UniversalId::Type_Npc && index.second != CSMWorld::UniversalId::Type_Creature)
|
||||
|
@ -199,9 +194,7 @@ bool CSMTools::TopicInfoCheckStage::verifyCell(const std::string& cell, const CS
|
|||
{
|
||||
if (mCellNames.find(cell) == mCellNames.end())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Cell '" << cell << "' does not exist";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, "Cell '" + cell + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -236,7 +229,7 @@ bool CSMTools::TopicInfoCheckStage::verifyFactionRank(const std::string& faction
|
|||
stream << "Faction rank is set to " << rank << " which is more than the maximum of " << limit - 1
|
||||
<< " for the '" << factionName << "' faction";
|
||||
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -250,16 +243,12 @@ bool CSMTools::TopicInfoCheckStage::verifyItem(const std::string& item, const CS
|
|||
|
||||
if (index.first == -1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Item '" << item << "' does not exist";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, ("Item '" + item + "' does not exist"), "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
else if (mReferencables.getRecord(index).isDeleted())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Deleted item '" << item << "' is being referenced";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, ("Deleted item '" + item + "' is being referenced"), "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -327,18 +316,12 @@ bool CSMTools::TopicInfoCheckStage::verifySelectStruct(const ESM::DialInfo::Sele
|
|||
}
|
||||
else if (infoCondition.conditionIsAlwaysTrue())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Condition '" << infoCondition.toString() << "' is always true";
|
||||
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, "Condition '" + infoCondition.toString() + "' is always true", "", CSMDoc::Message::Severity_Warning);
|
||||
return false;
|
||||
}
|
||||
else if (infoCondition.conditionIsNeverTrue())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Condition '" << infoCondition.toString() << "' is never true";
|
||||
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Warning);
|
||||
messages.add(id, "Condition '" + infoCondition.toString() + "' is never true", "", CSMDoc::Message::Severity_Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -397,9 +380,7 @@ bool CSMTools::TopicInfoCheckStage::verifySound(const std::string& sound, const
|
|||
{
|
||||
if (mSoundFiles.searchId(sound) == -1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Sound file '" << sound << "' does not exist";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, "Sound file '" + sound + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -414,16 +395,12 @@ bool CSMTools::TopicInfoCheckStage::verifyId(const std::string& name, const CSMW
|
|||
|
||||
if (index == -1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << T::getRecordType() + " '" << name << "' does not exist";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, T::getRecordType() + " '" + name + "' does not exist", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
else if (collection.getRecord(index).isDeleted())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << "Deleted " << T::getRecordType() << " record '" << name << "' is being referenced";
|
||||
messages.add(id, stream.str(), "", CSMDoc::Message::Severity_Error);
|
||||
messages.add(id, "Deleted " + T::getRecordType() + " record '" + name + "' is being referenced", "", CSMDoc::Message::Severity_Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue