forked from mirror/openmw-tes3mp
Added ingredient check
This commit is contained in:
parent
c1715779fa
commit
6c95cea4c4
4 changed files with 61 additions and 7 deletions
|
@ -18,7 +18,8 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(const CSMWorld::RefId
|
|||
mClothingSize(0),
|
||||
mContainersSize(0),
|
||||
mCreaturesSize(0),
|
||||
mDoorsSize(0)
|
||||
mDoorsSize(0),
|
||||
mIngredientsSize(0)
|
||||
{
|
||||
setSizeVariables();
|
||||
}
|
||||
|
@ -34,6 +35,7 @@ void CSMTools::ReferenceableCheckStage::setSizeVariables()
|
|||
mContainersSize = mReferencables.getContainers().getSize();
|
||||
mCreaturesSize = mReferencables.getCreatures().getSize();
|
||||
mDoorsSize = mReferencables.getDoors().getSize();
|
||||
mIngredientsSize = mReferencables.getIngredients().getSize();
|
||||
}
|
||||
|
||||
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
||||
|
@ -94,13 +96,13 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str
|
|||
}
|
||||
|
||||
stage -= mContainersSize;
|
||||
|
||||
|
||||
if (stage < mDoorsSize)
|
||||
{
|
||||
doorCheck(stage, mReferencables.getDoors(), messages);
|
||||
return;
|
||||
doorCheck(stage, mReferencables.getDoors(), messages);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
stage -= mDoorsSize;
|
||||
}
|
||||
|
||||
|
@ -516,9 +518,9 @@ void CSMTools::ReferenceableCheckStage::doorCheck(int stage, const CSMWorld::Ref
|
|||
return;
|
||||
}
|
||||
|
||||
const ESM::Door& Door= (static_cast<const CSMWorld::Record<ESM::Door>&>(baserecord)).get();
|
||||
const ESM::Door& Door = (static_cast<const CSMWorld::Record<ESM::Door>&>(baserecord)).get();
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Door, Door.mId);
|
||||
|
||||
|
||||
//usual, name and model
|
||||
if (Door.mName.empty())
|
||||
{
|
||||
|
@ -529,4 +531,49 @@ void CSMTools::ReferenceableCheckStage::doorCheck(int stage, const CSMWorld::Ref
|
|||
{
|
||||
messages.push_back(id.toString() + "|" + Door.mId + " has no model");
|
||||
}
|
||||
|
||||
//TODO, check what static unsigned int sRecordId; is for
|
||||
}
|
||||
|
||||
void CSMTools::ReferenceableCheckStage::ingredientCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Ingredient >& records, std::vector< std::string >& messages)
|
||||
{
|
||||
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
||||
|
||||
if (baserecord.isDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const ESM::Ingredient& Ingredient = (static_cast<const CSMWorld::Record<ESM::Ingredient>& >(baserecord)).get();
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Ingredient, Ingredient.mId);
|
||||
|
||||
//Checking for name
|
||||
if (Ingredient.mName.empty())
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + Ingredient.mId + " has an empty name");
|
||||
}
|
||||
|
||||
//Checking for weight
|
||||
if (Ingredient.mData.mWeight < 0)
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + Ingredient.mId + " has negative weight");
|
||||
}
|
||||
|
||||
//Checking for value
|
||||
if (Ingredient.mData.mValue < 0)
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + Ingredient.mId + " has negative value");
|
||||
}
|
||||
|
||||
//checking for model
|
||||
if (Ingredient.mModel.empty())
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + Ingredient.mId + " has no model");
|
||||
}
|
||||
|
||||
//checking for icon
|
||||
if (Ingredient.mIcon.empty())
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + Ingredient.mId + " has no icon");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace CSMTools
|
|||
void containerCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Container>& records, std::vector<std::string>& messages);
|
||||
void creatureCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Creature>& records, std::vector<std::string>& messages);
|
||||
void doorCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Door>& records, std::vector<std::string>& messages);
|
||||
void ingredientCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Ingredient>& records, std::vector<std::string>& messages);
|
||||
|
||||
void setSizeVariables();
|
||||
|
||||
|
@ -41,6 +42,7 @@ namespace CSMTools
|
|||
int mContainersSize;
|
||||
int mCreaturesSize;
|
||||
int mDoorsSize;
|
||||
int mIngredientsSize;
|
||||
};
|
||||
}
|
||||
#endif // REFERENCEABLECHECKSTAGE_H
|
||||
|
|
|
@ -277,3 +277,7 @@ const CSMWorld::RefIdDataContainer< ESM::Door >& CSMWorld::RefIdData::getDoors()
|
|||
return mDoors;
|
||||
}
|
||||
|
||||
const CSMWorld::RefIdDataContainer< ESM::Ingredient >& CSMWorld::RefIdData::getIngredients() const
|
||||
{
|
||||
return mIngredients;
|
||||
}
|
||||
|
|
|
@ -230,6 +230,7 @@ namespace CSMWorld
|
|||
const RefIdDataContainer<ESM::Container>& getContainers() const;
|
||||
const RefIdDataContainer<ESM::Creature>& getCreatures() const;
|
||||
const RefIdDataContainer<ESM::Door>& getDoors() const;
|
||||
const RefIdDataContainer<ESM::Ingredient>& getIngredients() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue