1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-19 04:09:40 +00:00

added container check

This commit is contained in:
Marek Kochanowicz 2013-12-22 14:42:17 +01:00
parent 1a7f023237
commit 16af9e6986
2 changed files with 40 additions and 0 deletions

View file

@ -82,6 +82,14 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str
}
stage -= mClothingSize;
if (stage < mContainersSize)
{
containerCheck(stage, mReferencables.getContainers(), messages);
return;
}
stage -= mContainersSize;
}
int CSMTools::ReferenceableCheckStage::setup()
@ -361,3 +369,34 @@ void CSMTools::ReferenceableCheckStage::clothingCheck(int stage, const CSMWorld:
messages.push_back(id.toString() + "|" + Clothing.mId + " has negative enchantment");
}
}
void CSMTools::ReferenceableCheckStage::containerCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Container >& records, std::vector< std::string >& messages)
{
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
if (baserecord.isDeleted())
{
return;
}
const ESM::Container& Container = (static_cast<const CSMWorld::Record<ESM::Container>& >(baserecord)).get();
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Container, Container.mId);
//Checking for model, IIRC all containers should have a model
if (Container.mModel.empty())
{
messages.push_back(id.toString() + "|" + Container.mId + " has no model");
}
//Checking for capacity (weight)
if (Container.mWeight < 0) //0 is allowed
{
messages.push_back(id.toString() + "|" + Container.mId + " has negative weight (capacity)");
}
//checking for name
if (Container.mName.empty())
{
messages.push_back(id.toString() + "|" + Container.mId + " has an empty name");
}
}

View file

@ -23,6 +23,7 @@ namespace CSMTools
void apparatusCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Apparatus>& records, std::vector<std::string>& messages);
void armorCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Armor>& records, std::vector<std::string>& messages);
void clothingCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Clothing>& records, std::vector<std::string>& messages);
void containerCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Container>& records, std::vector<std::string>& messages);
void setSizeVariables();