2013-12-20 19:02:42 +00:00
|
|
|
|
#include "referenceablecheck.hpp"
|
|
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
|
|
#include "../world/record.hpp"
|
|
|
|
|
|
|
|
|
|
#include "../world/universalid.hpp"
|
|
|
|
|
|
|
|
|
|
CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(const CSMWorld::RefIdData& referenceable) :
|
|
|
|
|
mReferencables(referenceable),
|
2013-12-20 21:31:17 +00:00
|
|
|
|
mBooksSize(0),
|
2013-12-21 10:02:58 +00:00
|
|
|
|
mActivatorsSize(0),
|
2013-12-21 11:07:40 +00:00
|
|
|
|
mPotionsSize(0),
|
2013-12-22 13:22:03 +00:00
|
|
|
|
mApparatiSize(0),
|
2013-12-22 13:32:42 +00:00
|
|
|
|
mArmorsSzie(0),
|
2013-12-22 13:35:40 +00:00
|
|
|
|
mClothingSize(0),
|
2013-12-22 13:46:07 +00:00
|
|
|
|
mContainersSize(0),
|
2013-12-26 11:59:43 +00:00
|
|
|
|
mCreaturesSize(0),
|
2013-12-26 14:24:52 +00:00
|
|
|
|
mDoorsSize(0),
|
2013-12-26 14:35:58 +00:00
|
|
|
|
mIngredientsSize(0),
|
2013-12-26 17:28:24 +00:00
|
|
|
|
mCreaturesLevListsSize(0),
|
|
|
|
|
mItemLevelledListsSize(0)
|
2013-12-20 19:02:42 +00:00
|
|
|
|
{
|
|
|
|
|
setSizeVariables();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-21 11:07:40 +00:00
|
|
|
|
void CSMTools::ReferenceableCheckStage::setSizeVariables()
|
|
|
|
|
{
|
|
|
|
|
mBooksSize = mReferencables.getBooks().getSize();
|
|
|
|
|
mActivatorsSize = mReferencables.getActivators().getSize();
|
|
|
|
|
mPotionsSize = mReferencables.getPotions().getSize();
|
|
|
|
|
mApparatiSize = mReferencables.getApparati().getSize();
|
2013-12-22 13:22:03 +00:00
|
|
|
|
mArmorsSzie = mReferencables.getArmors().getSize();
|
2013-12-22 13:32:42 +00:00
|
|
|
|
mClothingSize = mReferencables.getClothing().getSize();
|
2013-12-22 13:35:40 +00:00
|
|
|
|
mContainersSize = mReferencables.getContainers().getSize();
|
2013-12-22 13:46:07 +00:00
|
|
|
|
mCreaturesSize = mReferencables.getCreatures().getSize();
|
2013-12-26 11:59:43 +00:00
|
|
|
|
mDoorsSize = mReferencables.getDoors().getSize();
|
2013-12-26 14:24:52 +00:00
|
|
|
|
mIngredientsSize = mReferencables.getIngredients().getSize();
|
2013-12-26 14:35:58 +00:00
|
|
|
|
mCreaturesLevListsSize = mReferencables.getCreatureLevelledLists().getSize();
|
2013-12-26 17:28:24 +00:00
|
|
|
|
mItemLevelledListsSize = mReferencables.getItemLevelledList().getSize();
|
2013-12-21 11:07:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-20 19:02:42 +00:00
|
|
|
|
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
|
|
|
|
{
|
2013-12-20 21:31:17 +00:00
|
|
|
|
//Checks for books, than, when stage is above mBooksSize goes to other checks, with (stage - PrevSum) as stage.
|
2013-12-21 14:40:39 +00:00
|
|
|
|
if (stage < mBooksSize)
|
2013-12-20 21:31:17 +00:00
|
|
|
|
{
|
|
|
|
|
bookCheck(stage, mReferencables.getBooks(), messages);
|
2013-12-20 19:02:42 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-21 10:15:46 +00:00
|
|
|
|
|
2013-12-21 10:01:40 +00:00
|
|
|
|
stage -= mBooksSize;
|
2013-12-21 10:15:46 +00:00
|
|
|
|
|
2013-12-21 14:40:39 +00:00
|
|
|
|
if (stage < mActivatorsSize)
|
2013-12-20 21:31:17 +00:00
|
|
|
|
{
|
2013-12-21 10:01:40 +00:00
|
|
|
|
activatorCheck(stage, mReferencables.getActivators(), messages);
|
2013-12-21 10:15:46 +00:00
|
|
|
|
return;
|
2013-12-20 21:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-21 10:15:46 +00:00
|
|
|
|
stage -= mActivatorsSize;
|
|
|
|
|
|
2013-12-21 14:40:39 +00:00
|
|
|
|
if (stage < mPotionsSize)
|
2013-12-20 21:31:17 +00:00
|
|
|
|
{
|
2013-12-21 11:07:40 +00:00
|
|
|
|
potionCheck(stage, mReferencables.getPotions(), messages);
|
2013-12-20 21:31:17 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-21 10:15:46 +00:00
|
|
|
|
|
|
|
|
|
stage -= mPotionsSize;
|
2013-12-22 13:22:03 +00:00
|
|
|
|
|
2013-12-21 14:40:39 +00:00
|
|
|
|
if (stage < mApparatiSize)
|
2013-12-21 11:07:40 +00:00
|
|
|
|
{
|
2013-12-22 13:22:03 +00:00
|
|
|
|
apparatusCheck(stage, mReferencables.getApparati(), messages);
|
|
|
|
|
return;
|
2013-12-21 11:07:40 +00:00
|
|
|
|
}
|
2013-12-22 13:22:03 +00:00
|
|
|
|
|
2013-12-21 11:07:40 +00:00
|
|
|
|
stage -= mApparatiSize;
|
2013-12-22 13:22:03 +00:00
|
|
|
|
|
|
|
|
|
if (stage < mArmorsSzie)
|
|
|
|
|
{
|
|
|
|
|
armorCheck(stage, mReferencables.getArmors(), messages);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-22 13:32:42 +00:00
|
|
|
|
|
2013-12-22 13:22:03 +00:00
|
|
|
|
stage -= mArmorsSzie;
|
2013-12-22 13:32:42 +00:00
|
|
|
|
|
|
|
|
|
if (stage < mClothingSize)
|
|
|
|
|
{
|
|
|
|
|
clothingCheck(stage, mReferencables.getClothing(), messages);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage -= mClothingSize;
|
2013-12-23 11:32:35 +00:00
|
|
|
|
|
2013-12-22 13:42:17 +00:00
|
|
|
|
if (stage < mContainersSize)
|
|
|
|
|
{
|
2013-12-23 11:32:35 +00:00
|
|
|
|
containerCheck(stage, mReferencables.getContainers(), messages);
|
|
|
|
|
return;
|
2013-12-22 13:42:17 +00:00
|
|
|
|
}
|
2013-12-23 11:32:35 +00:00
|
|
|
|
|
2013-12-22 13:42:17 +00:00
|
|
|
|
stage -= mContainersSize;
|
2013-12-26 14:24:52 +00:00
|
|
|
|
|
2013-12-26 11:59:43 +00:00
|
|
|
|
if (stage < mDoorsSize)
|
|
|
|
|
{
|
2013-12-26 14:24:52 +00:00
|
|
|
|
doorCheck(stage, mReferencables.getDoors(), messages);
|
|
|
|
|
return;
|
2013-12-26 11:59:43 +00:00
|
|
|
|
}
|
2013-12-26 14:24:52 +00:00
|
|
|
|
|
2013-12-26 11:59:43 +00:00
|
|
|
|
stage -= mDoorsSize;
|
2013-12-26 17:16:54 +00:00
|
|
|
|
|
2013-12-26 14:35:58 +00:00
|
|
|
|
if (stage < mIngredientsSize)
|
|
|
|
|
{
|
2013-12-26 17:16:54 +00:00
|
|
|
|
ingredientCheck(stage, mReferencables.getIngredients(), messages);
|
|
|
|
|
return;
|
2013-12-26 14:35:58 +00:00
|
|
|
|
}
|
2013-12-26 17:16:54 +00:00
|
|
|
|
|
2013-12-26 14:35:58 +00:00
|
|
|
|
stage -= mIngredientsSize;
|
2013-12-26 17:16:54 +00:00
|
|
|
|
|
|
|
|
|
if (stage < mCreaturesLevListsSize)
|
|
|
|
|
{
|
|
|
|
|
creaturesLevListCheck(stage, mReferencables.getCreatureLevelledLists(), messages);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage -= mCreaturesLevListsSize;
|
2013-12-26 17:28:24 +00:00
|
|
|
|
|
|
|
|
|
if (stage < mItemLevelledListsSize)
|
|
|
|
|
{
|
|
|
|
|
mItemLevelledListCheck(stage, mReferencables.getItemLevelledList(), messages);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage -= mItemLevelledListsSize;
|
2013-12-20 19:02:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int CSMTools::ReferenceableCheckStage::setup()
|
|
|
|
|
{
|
|
|
|
|
return mReferencables.getSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::bookCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Book >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Book& Book = (static_cast<const CSMWorld::Record<ESM::Book>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Book, Book.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for name
|
|
|
|
|
if (Book.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Book.mId + " has an empty name");
|
|
|
|
|
}
|
2013-12-20 21:31:17 +00:00
|
|
|
|
|
|
|
|
|
//Checking for weight
|
|
|
|
|
if (Book.mData.mWeight < 0)
|
|
|
|
|
{
|
2013-12-21 11:07:40 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Book.mId + " has negative weight");
|
2013-12-20 21:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for value
|
|
|
|
|
if (Book.mData.mValue < 0)
|
|
|
|
|
{
|
2013-12-21 11:07:40 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Book.mId + " has negative value");
|
2013-12-20 21:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for model
|
|
|
|
|
if (Book.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Book.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for icon
|
|
|
|
|
if (Book.mIcon.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Book.mId + " has no icon");
|
|
|
|
|
}
|
2013-12-22 13:22:03 +00:00
|
|
|
|
|
2013-12-21 11:07:40 +00:00
|
|
|
|
//checking for enchantment points
|
|
|
|
|
if (Book.mData.mEnchant < 0)
|
|
|
|
|
{
|
2013-12-22 13:22:03 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Book.mId + " has negative enchantment");
|
2013-12-21 11:07:40 +00:00
|
|
|
|
}
|
2013-12-20 21:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::activatorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Activator >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Activator& Activator = (static_cast<const CSMWorld::Record<ESM::Activator>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Activator, Activator.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for model, IIRC all activators should have a model
|
|
|
|
|
if (Activator.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Activator.mId + " has no model");
|
|
|
|
|
}
|
2013-12-20 19:02:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-21 11:07:40 +00:00
|
|
|
|
void CSMTools::ReferenceableCheckStage::potionCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Potion >& records, std::vector< std::string >& messages)
|
2013-12-21 10:15:46 +00:00
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Potion& Potion = (static_cast<const CSMWorld::Record<ESM::Potion>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Potion, Potion.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for name
|
|
|
|
|
if (Potion.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Potion.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for weight
|
|
|
|
|
if (Potion.mData.mWeight < 0)
|
|
|
|
|
{
|
2013-12-21 11:07:40 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Potion.mId + " has negative weight");
|
2013-12-21 10:15:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for value
|
|
|
|
|
if (Potion.mData.mValue < 0)
|
|
|
|
|
{
|
2013-12-21 11:07:40 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Potion.mId + " has negative value");
|
2013-12-21 10:15:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for model
|
|
|
|
|
if (Potion.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Potion.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for icon
|
|
|
|
|
if (Potion.mIcon.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Potion.mId + " has no icon");
|
|
|
|
|
}
|
2013-12-22 13:22:03 +00:00
|
|
|
|
|
2013-12-21 10:15:46 +00:00
|
|
|
|
//IIRC potion can have empty effects list just fine.
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-21 11:07:40 +00:00
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::apparatusCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Apparatus >& records, std::vector< std::string >& messages)
|
2013-12-20 19:02:42 +00:00
|
|
|
|
{
|
2013-12-21 11:07:40 +00:00
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Apparatus& Apparatus = (static_cast<const CSMWorld::Record<ESM::Apparatus>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Apparatus, Apparatus.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for name
|
|
|
|
|
if (Apparatus.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for weight
|
|
|
|
|
if (Apparatus.mData.mWeight < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has negative weight");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for value
|
|
|
|
|
if (Apparatus.mData.mValue < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has negative value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for model
|
|
|
|
|
if (Apparatus.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for icon
|
|
|
|
|
if (Apparatus.mIcon.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has no icon");
|
|
|
|
|
}
|
2013-12-22 13:22:03 +00:00
|
|
|
|
|
2013-12-22 09:00:04 +00:00
|
|
|
|
//checking for quality, 0 → apparatus is basicly useless, any negative → apparatus is harmfull instead of helpfull
|
|
|
|
|
if (Apparatus.mData.mQuality <= 0)
|
|
|
|
|
{
|
2013-12-22 13:22:03 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Apparatus.mId + " has non-positive quality");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::armorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Armor >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Armor& Armor = (static_cast<const CSMWorld::Record<ESM::Armor>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Armor, Armor.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for name
|
|
|
|
|
if (Armor.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for weight
|
|
|
|
|
if (Armor.mData.mWeight < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative weight");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for value
|
|
|
|
|
if (Armor.mData.mValue < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for model
|
|
|
|
|
if (Armor.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for icon
|
|
|
|
|
if (Armor.mIcon.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has no icon");
|
|
|
|
|
}
|
2013-12-22 13:32:42 +00:00
|
|
|
|
|
|
|
|
|
//checking for enchantment points
|
2013-12-22 13:22:03 +00:00
|
|
|
|
if (Armor.mData.mEnchant < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative enchantment");
|
|
|
|
|
}
|
2013-12-22 13:32:42 +00:00
|
|
|
|
|
2013-12-22 13:22:03 +00:00
|
|
|
|
//checking for armor class, armor should have poistive armor class, but 0 is considered legal
|
|
|
|
|
if (Armor.mData.mArmor < 0)
|
|
|
|
|
{
|
2013-12-22 13:32:42 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has negative armor class");
|
2013-12-22 13:22:03 +00:00
|
|
|
|
}
|
2013-12-22 13:32:42 +00:00
|
|
|
|
|
2013-12-22 13:22:03 +00:00
|
|
|
|
//checking for health. Only positive numbers are allowed, and 0 is illegal
|
|
|
|
|
if (Armor.mData.mHealth <= 0)
|
|
|
|
|
{
|
2013-12-22 13:32:42 +00:00
|
|
|
|
messages.push_back(id.toString() + "|" + Armor.mId + " has non positive health");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::clothingCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Clothing >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Clothing& Clothing = (static_cast<const CSMWorld::Record<ESM::Clothing>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Clothing, Clothing.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for name
|
|
|
|
|
if (Clothing.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Clothing.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for weight
|
|
|
|
|
if (Clothing.mData.mWeight < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Clothing.mId + " has negative weight");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for value
|
|
|
|
|
if (Clothing.mData.mValue < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Clothing.mId + " has negative value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for model
|
|
|
|
|
if (Clothing.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Clothing.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for icon
|
|
|
|
|
if (Clothing.mIcon.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Clothing.mId + " has no icon");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for enchantment points
|
|
|
|
|
if (Clothing.mData.mEnchant < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Clothing.mId + " has negative enchantment");
|
2013-12-22 09:00:04 +00:00
|
|
|
|
}
|
2013-12-21 14:40:39 +00:00
|
|
|
|
}
|
2013-12-22 13:42:17 +00:00
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::containerCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Container >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Container& Container = (static_cast<const CSMWorld::Record<ESM::Container>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Container, Container.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for model, IIRC all containers should have a model
|
|
|
|
|
if (Container.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Container.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for capacity (weight)
|
|
|
|
|
if (Container.mWeight < 0) //0 is allowed
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Container.mId + " has negative weight (capacity)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for name
|
|
|
|
|
if (Container.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Container.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-23 11:32:35 +00:00
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::creatureCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Creature >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Creature& Creature = (static_cast<const CSMWorld::Record<ESM::Creature>&>(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Creature, Creature.mId);
|
|
|
|
|
|
|
|
|
|
if (Creature.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//stats checks
|
|
|
|
|
if (Creature.mData.mLevel < 1)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has non-postive level");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mStrength < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative strength");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mIntelligence < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative intelligence");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mWillpower < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative willpower");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mAgility < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative agility");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mSpeed < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative speed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mEndurance < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative endurance");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mPersonality < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative personality");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mLuck < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative luck");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mHealth < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative health");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Creature.mData.mSoul < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative soul value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 6; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (Creature.mData.mAttack[i] < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative attack strength");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO, find meaning of other values
|
2013-12-26 11:59:43 +00:00
|
|
|
|
if (Creature.mData.mGold < 0) //It seems that this is for gold in merchant creatures
|
2013-12-23 11:32:35 +00:00
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Creature.mId + " has negative gold ");
|
|
|
|
|
}
|
2013-12-26 11:59:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::doorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Door >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-26 14:24:52 +00:00
|
|
|
|
const ESM::Door& Door = (static_cast<const CSMWorld::Record<ESM::Door>&>(baserecord)).get();
|
2013-12-26 11:59:43 +00:00
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Door, Door.mId);
|
2013-12-26 14:24:52 +00:00
|
|
|
|
|
2013-12-26 11:59:43 +00:00
|
|
|
|
//usual, name and model
|
|
|
|
|
if (Door.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Door.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Door.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Door.mId + " has no model");
|
|
|
|
|
}
|
2013-12-26 14:24:52 +00:00
|
|
|
|
|
|
|
|
|
//TODO, check what static unsigned int sRecordId; is for
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::ingredientCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Ingredient >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::Ingredient& Ingredient = (static_cast<const CSMWorld::Record<ESM::Ingredient>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Ingredient, Ingredient.mId);
|
|
|
|
|
|
|
|
|
|
//Checking for name
|
|
|
|
|
if (Ingredient.mName.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Ingredient.mId + " has an empty name");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for weight
|
|
|
|
|
if (Ingredient.mData.mWeight < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Ingredient.mId + " has negative weight");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Checking for value
|
|
|
|
|
if (Ingredient.mData.mValue < 0)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Ingredient.mId + " has negative value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for model
|
|
|
|
|
if (Ingredient.mModel.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Ingredient.mId + " has no model");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//checking for icon
|
|
|
|
|
if (Ingredient.mIcon.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + Ingredient.mId + " has no icon");
|
|
|
|
|
}
|
2013-12-23 11:32:35 +00:00
|
|
|
|
}
|
2013-12-26 14:35:58 +00:00
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::CreatureLevList >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
2013-12-26 17:16:54 +00:00
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
2013-12-26 14:35:58 +00:00
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ESM::CreatureLevList& CreatureLevList = (static_cast<const CSMWorld::Record<ESM::CreatureLevList>& >(baserecord)).get();
|
2013-12-26 17:16:54 +00:00
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_CreatureLevelledList, CreatureLevList.mId); //CreatureLevList but Type_CreatureLevelledList :/
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < CreatureLevList.mList.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (CreatureLevList.mList[i].mId.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + CreatureLevList.mId + " contains item with empty Id");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CreatureLevList.mList[i].mLevel < 1)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + CreatureLevList.mId + " contains item with non-positive level");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CreatureLevList.mChanceNone < 0 or CreatureLevList.mChanceNone > 100)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + CreatureLevList.mId + " chance to be empty is not beetween 0 and 100");
|
|
|
|
|
}
|
2013-12-26 17:28:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMTools::ReferenceableCheckStage::mItemLevelledListCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::ItemLevList >& records, std::vector< std::string >& messages)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
|
|
|
|
|
|
|
|
|
if (baserecord.isDeleted())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-26 17:16:54 +00:00
|
|
|
|
|
2013-12-26 17:28:24 +00:00
|
|
|
|
const ESM::ItemLevList& ItemLevList = (static_cast<const CSMWorld::Record<ESM::ItemLevList>& >(baserecord)).get();
|
|
|
|
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_ItemLevelledList, CreatureLevList.mId);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ItemLevList.mList.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (ItemLevList.mList[i].mId.empty())
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + ItemLevList.mId + " contains item with empty Id");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ItemLevList.mList[i].mLevel < 1)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + ItemLevList.mId + " contains item with non-positive level");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ItemLevList.mChanceNone < 0 or ItemLevList.mChanceNone > 100)
|
|
|
|
|
{
|
|
|
|
|
messages.push_back(id.toString() + "|" + ItemLevList.mId + " chance to be empty is not beetween 0 and 100");
|
|
|
|
|
}
|
2013-12-26 17:16:54 +00:00
|
|
|
|
}
|