1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 08:36:40 +00:00

added creature leveled list check

This commit is contained in:
Marek Kochanowicz 2013-12-26 18:16:54 +01:00
parent 360a939aa0
commit c2993909cf

View file

@ -106,14 +106,22 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str
} }
stage -= mDoorsSize; stage -= mDoorsSize;
if (stage < mIngredientsSize) if (stage < mIngredientsSize)
{ {
ingredientCheck(stage, mReferencables.getIngredients(), messages); ingredientCheck(stage, mReferencables.getIngredients(), messages);
return; return;
} }
stage -= mIngredientsSize; stage -= mIngredientsSize;
if (stage < mCreaturesLevListsSize)
{
creaturesLevListCheck(stage, mReferencables.getCreatureLevelledLists(), messages);
return;
}
stage -= mCreaturesLevListsSize;
} }
int CSMTools::ReferenceableCheckStage::setup() int CSMTools::ReferenceableCheckStage::setup()
@ -590,7 +598,7 @@ void CSMTools::ReferenceableCheckStage::ingredientCheck(int stage, const CSMWorl
void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::CreatureLevList >& records, std::vector< std::string >& messages) void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::CreatureLevList >& records, std::vector< std::string >& messages)
{ {
const CSMWorld::RecordBase& baserecord = records.getRecord(stage); const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
if (baserecord.isDeleted()) if (baserecord.isDeleted())
{ {
@ -598,7 +606,25 @@ void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(int stage, const C
} }
const ESM::CreatureLevList& CreatureLevList = (static_cast<const CSMWorld::Record<ESM::CreatureLevList>& >(baserecord)).get(); const ESM::CreatureLevList& CreatureLevList = (static_cast<const CSMWorld::Record<ESM::CreatureLevList>& >(baserecord)).get();
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_CreatureLevList, CreatureLevList.mId); 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");
}
//TODO(!) //TODO(!)
} }