diff --git a/apps/opencs/model/tools/referenceablecheck.cpp b/apps/opencs/model/tools/referenceablecheck.cpp index 2b796ccc04..0b09f1f5d3 100644 --- a/apps/opencs/model/tools/referenceablecheck.cpp +++ b/apps/opencs/model/tools/referenceablecheck.cpp @@ -186,35 +186,7 @@ void CSMTools::ReferenceableCheckStage::bookCheck(int stage, const CSMWorld::Ref const ESM::Book& Book = (dynamic_cast& >(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(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"); + } +} diff --git a/apps/opencs/model/tools/referenceablecheck.hpp b/apps/opencs/model/tools/referenceablecheck.hpp index fcf774f148..43bb54fa79 100644 --- a/apps/opencs/model/tools/referenceablecheck.hpp +++ b/apps/opencs/model/tools/referenceablecheck.hpp @@ -34,6 +34,9 @@ namespace CSMTools void miscCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); void npcCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); + //TEMPLATE CHECKS + template void inventoryItemCheck(const item& item, std::vector& messages); //for all inventory items. + const CSMWorld::RefIdData& mReferencables; const CSMWorld::IdCollection& mRaces; const CSMWorld::IdCollection& mClasses;