diff --git a/apps/opencs/model/tools/referenceablecheck.cpp b/apps/opencs/model/tools/referenceablecheck.cpp index ff2d6e713..59591ca02 100644 --- a/apps/opencs/model/tools/referenceablecheck.cpp +++ b/apps/opencs/model/tools/referenceablecheck.cpp @@ -20,31 +20,30 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(const CSMWorld::RefId void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages) { //Checks for books, than, when stage is above mBooksSize goes to other checks, with (stage - PrevSum) as stage. - bool CheckPerformed = false; if (stage <= mBooksSize) { bookCheck(stage, mReferencables.getBooks(), messages); - CheckPerformed = true; - } - - if (CheckPerformed) - { return; } + stage -= mBooksSize; - - if ((stage) <= mActivatorsSize) + + if (stage <= mActivatorsSize) { activatorCheck(stage, mReferencables.getActivators(), messages); - CheckPerformed = true; - } - - if (CheckPerformed) - { return; } + stage -= mActivatorsSize; + + if (stage <= mPotionsSize) + { + potionsCheck(stage, mReferencables.getPotions(), messages); + return; + } + + stage -= mPotionsSize; } int CSMTools::ReferenceableCheckStage::setup() @@ -114,6 +113,50 @@ void CSMTools::ReferenceableCheckStage::activatorCheck(int stage, const CSMWorld } } +void CSMTools::ReferenceableCheckStage::potionsCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Potion >& records, std::vector< std::string >& messages) +{ + const CSMWorld::RecordBase& baserecord = records.getRecord(stage); + + if (baserecord.isDeleted()) + { + return; + } + + const ESM::Potion& Potion = (static_cast& >(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) + { + messages.push_back(id.toString() + "|" + Potion.mId + " has a negative weight"); + } + + //Checking for value + if (Potion.mData.mValue < 0) + { + messages.push_back(id.toString() + "|" + Potion.mId + " has a negative value"); + } + +//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"); + } + //IIRC potion can have empty effects list just fine. +} + void CSMTools::ReferenceableCheckStage::setSizeVariables() { mBooksSize = mReferencables.getBooks().getSize(); diff --git a/apps/opencs/model/tools/referenceablecheck.hpp b/apps/opencs/model/tools/referenceablecheck.hpp index fed662e27..801a2232b 100644 --- a/apps/opencs/model/tools/referenceablecheck.hpp +++ b/apps/opencs/model/tools/referenceablecheck.hpp @@ -18,12 +18,14 @@ namespace CSMTools private: void bookCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Book >& records, std::vector< std::string >& messages); void activatorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Activator >& records, std::vector< std::string >& messages); - void setSizeVariables(); + void potionsCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); + + void setSizeVariables(); const CSMWorld::RefIdData mReferencables; - int mBooksSize; - int mActivatorsSize; - int mPotionsSize; + int mBooksSize; + int mActivatorsSize; + int mPotionsSize; }; } #endif // REFERENCEABLECHECKSTAGE_H