1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-14 01:19:59 +00:00

Inventory item template.

This commit is contained in:
Marek Kochanowicz 2014-01-02 20:20:18 +01:00
parent cb723710fe
commit 8201c97abf
2 changed files with 38 additions and 29 deletions

View File

@ -186,35 +186,7 @@ void CSMTools::ReferenceableCheckStage::bookCheck(int stage, const CSMWorld::Ref
const ESM::Book& Book = (dynamic_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");
}
//Checking for weight
if (Book.mData.mWeight < 0)
{
messages.push_back(id.toString() + "|" + Book.mId + " has negative weight");
}
//Checking for value
if (Book.mData.mValue < 0)
{
messages.push_back(id.toString() + "|" + Book.mId + " has negative value");
}
//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");
}
inventoryItemCheck<ESM::Book>(Book, messages);
//checking for enchantment points
if (Book.mData.mEnchant < 0)
@ -1009,3 +981,37 @@ void CSMTools::ReferenceableCheckStage::npcCheck(int stage, const CSMWorld::RefI
//TODO: reputation, Disposition, rank, everything else
}
//Templates begins here
void CSMTools::ReferenceableCheckStage::inventoryItemCheck(const item& item, std::vector< std::string >& messages)
{
if (item.mName.empty())
{
messages.push_back(id.toString() + "|" + item.mId + " has an empty name");
}
//Checking for weight
if (item.mData.mWeight < 0)
{
messages.push_back(id.toString() + "|" + item.mId + " has negative weight");
}
//Checking for value
if (item.mData.mValue < 0)
{
messages.push_back(id.toString() + "|" + item.mId + " has negative value");
}
//checking for model
if (item.mModel.empty())
{
messages.push_back(id.toString() + "|" + item.mId + " has no model");
}
//checking for icon
if (item.mIcon.empty())
{
messages.push_back(id.toString() + "|" + item.mId + " has no icon");
}
}

View File

@ -34,6 +34,9 @@ namespace CSMTools
void miscCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Miscellaneous>& records, std::vector<std::string>& messages);
void npcCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::NPC>& records, std::vector<std::string>& messages);
//TEMPLATE CHECKS
template<typename item> void inventoryItemCheck(const item& item, std::vector<std::string>& messages); //for all inventory items.
const CSMWorld::RefIdData& mReferencables;
const CSMWorld::IdCollection<ESM::Race>& mRaces;
const CSMWorld::IdCollection<ESM::Class>& mClasses;