mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-13 21:09:39 +00:00
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),
|
mClothingSize(0),
|
||||||
mContainersSize(0),
|
mContainersSize(0),
|
||||||
mCreaturesSize(0),
|
mCreaturesSize(0),
|
||||||
mDoorsSize(0)
|
mDoorsSize(0),
|
||||||
|
mIngredientsSize(0)
|
||||||
{
|
{
|
||||||
setSizeVariables();
|
setSizeVariables();
|
||||||
}
|
}
|
||||||
|
@ -34,6 +35,7 @@ void CSMTools::ReferenceableCheckStage::setSizeVariables()
|
||||||
mContainersSize = mReferencables.getContainers().getSize();
|
mContainersSize = mReferencables.getContainers().getSize();
|
||||||
mCreaturesSize = mReferencables.getCreatures().getSize();
|
mCreaturesSize = mReferencables.getCreatures().getSize();
|
||||||
mDoorsSize = mReferencables.getDoors().getSize();
|
mDoorsSize = mReferencables.getDoors().getSize();
|
||||||
|
mIngredientsSize = mReferencables.getIngredients().getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
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;
|
stage -= mContainersSize;
|
||||||
|
|
||||||
if (stage < mDoorsSize)
|
if (stage < mDoorsSize)
|
||||||
{
|
{
|
||||||
doorCheck(stage, mReferencables.getDoors(), messages);
|
doorCheck(stage, mReferencables.getDoors(), messages);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stage -= mDoorsSize;
|
stage -= mDoorsSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,9 +518,9 @@ void CSMTools::ReferenceableCheckStage::doorCheck(int stage, const CSMWorld::Ref
|
||||||
return;
|
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);
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Door, Door.mId);
|
||||||
|
|
||||||
//usual, name and model
|
//usual, name and model
|
||||||
if (Door.mName.empty())
|
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");
|
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 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 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 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();
|
void setSizeVariables();
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ namespace CSMTools
|
||||||
int mContainersSize;
|
int mContainersSize;
|
||||||
int mCreaturesSize;
|
int mCreaturesSize;
|
||||||
int mDoorsSize;
|
int mDoorsSize;
|
||||||
|
int mIngredientsSize;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // REFERENCEABLECHECKSTAGE_H
|
#endif // REFERENCEABLECHECKSTAGE_H
|
||||||
|
|
|
@ -277,3 +277,7 @@ const CSMWorld::RefIdDataContainer< ESM::Door >& CSMWorld::RefIdData::getDoors()
|
||||||
return mDoors;
|
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::Container>& getContainers() const;
|
||||||
const RefIdDataContainer<ESM::Creature>& getCreatures() const;
|
const RefIdDataContainer<ESM::Creature>& getCreatures() const;
|
||||||
const RefIdDataContainer<ESM::Door>& getDoors() const;
|
const RefIdDataContainer<ESM::Door>& getDoors() const;
|
||||||
|
const RefIdDataContainer<ESM::Ingredient>& getIngredients() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue