diff --git a/apps/opencs/model/tools/referenceablecheck.cpp b/apps/opencs/model/tools/referenceablecheck.cpp index 750ef64487..c8a310e9f3 100644 --- a/apps/opencs/model/tools/referenceablecheck.cpp +++ b/apps/opencs/model/tools/referenceablecheck.cpp @@ -84,13 +84,13 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str } stage -= mClothingSize; - + if (stage < mContainersSize) { - containerCheck(stage, mReferencables.getContainers(), messages); - return; + containerCheck(stage, mReferencables.getContainers(), messages); + return; } - + stage -= mContainersSize; } @@ -402,3 +402,99 @@ void CSMTools::ReferenceableCheckStage::containerCheck(int stage, const CSMWorld messages.push_back(id.toString() + "|" + Container.mId + " has an empty name"); } } + +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&>(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 + /* + if (Creature.mData.mGold < 0) + { + messages.push_back(id.toString() + "|" + Creature.mId + " has negative gold "); + } + */ +} diff --git a/apps/opencs/model/tools/referenceablecheck.hpp b/apps/opencs/model/tools/referenceablecheck.hpp index 17897fe34a..72af4e0ff7 100644 --- a/apps/opencs/model/tools/referenceablecheck.hpp +++ b/apps/opencs/model/tools/referenceablecheck.hpp @@ -24,6 +24,7 @@ namespace CSMTools void armorCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); void clothingCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); void containerCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); + void creatureCheck(int stage, const CSMWorld::RefIdDataContainer& records, std::vector& messages); void setSizeVariables(); diff --git a/components/esm/loadcrea.hpp b/components/esm/loadcrea.hpp index 99c4f52257..a39a7ebe13 100644 --- a/components/esm/loadcrea.hpp +++ b/components/esm/loadcrea.hpp @@ -66,7 +66,7 @@ struct Creature int mCombat, mMagic, mStealth; // Don't know yet. int mAttack[6]; // AttackMin1, AttackMax1, ditto2, ditto3 int mGold; - }; // 96 bytes + }; // 96 byte NPDTstruct mData;