mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 05:49:56 +00:00
Adde potionCheck method
This commit is contained in:
parent
21ee2a6d2e
commit
ee5dfd1cc8
2 changed files with 62 additions and 17 deletions
|
@ -20,31 +20,30 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(const CSMWorld::RefId
|
||||||
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
||||||
{
|
{
|
||||||
//Checks for books, than, when stage is above mBooksSize goes to other checks, with (stage - PrevSum) as stage.
|
//Checks for books, than, when stage is above mBooksSize goes to other checks, with (stage - PrevSum) as stage.
|
||||||
bool CheckPerformed = false;
|
|
||||||
|
|
||||||
if (stage <= mBooksSize)
|
if (stage <= mBooksSize)
|
||||||
{
|
{
|
||||||
bookCheck(stage, mReferencables.getBooks(), messages);
|
bookCheck(stage, mReferencables.getBooks(), messages);
|
||||||
CheckPerformed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckPerformed)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stage -= mBooksSize;
|
stage -= mBooksSize;
|
||||||
|
|
||||||
if ((stage) <= mActivatorsSize)
|
if (stage <= mActivatorsSize)
|
||||||
{
|
{
|
||||||
activatorCheck(stage, mReferencables.getActivators(), messages);
|
activatorCheck(stage, mReferencables.getActivators(), messages);
|
||||||
CheckPerformed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckPerformed)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stage -= mActivatorsSize;
|
stage -= mActivatorsSize;
|
||||||
|
|
||||||
|
if (stage <= mPotionsSize)
|
||||||
|
{
|
||||||
|
potionsCheck(stage, mReferencables.getPotions(), messages);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stage -= mPotionsSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSMTools::ReferenceableCheckStage::setup()
|
int CSMTools::ReferenceableCheckStage::setup()
|
||||||
|
@ -114,6 +113,50 @@ void CSMTools::ReferenceableCheckStage::activatorCheck(int stage, const CSMWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMTools::ReferenceableCheckStage::potionsCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Potion >& records, std::vector< std::string >& messages)
|
||||||
|
{
|
||||||
|
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
|
||||||
|
|
||||||
|
if (baserecord.isDeleted())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ESM::Potion& Potion = (static_cast<const CSMWorld::Record<ESM::Potion>& >(baserecord)).get();
|
||||||
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Potion, Potion.mId);
|
||||||
|
|
||||||
|
//Checking for name
|
||||||
|
if (Potion.mName.empty())
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Potion.mId + " has an empty name");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Checking for weight
|
||||||
|
if (Potion.mData.mWeight < 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Potion.mId + " has a negative weight");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Checking for value
|
||||||
|
if (Potion.mData.mValue < 0)
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Potion.mId + " has a negative value");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for model
|
||||||
|
if (Potion.mModel.empty())
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Potion.mId + " has no model");
|
||||||
|
}
|
||||||
|
|
||||||
|
//checking for icon
|
||||||
|
if (Potion.mIcon.empty())
|
||||||
|
{
|
||||||
|
messages.push_back(id.toString() + "|" + Potion.mId + " has no icon");
|
||||||
|
}
|
||||||
|
//IIRC potion can have empty effects list just fine.
|
||||||
|
}
|
||||||
|
|
||||||
void CSMTools::ReferenceableCheckStage::setSizeVariables()
|
void CSMTools::ReferenceableCheckStage::setSizeVariables()
|
||||||
{
|
{
|
||||||
mBooksSize = mReferencables.getBooks().getSize();
|
mBooksSize = mReferencables.getBooks().getSize();
|
||||||
|
|
|
@ -18,12 +18,14 @@ namespace CSMTools
|
||||||
private:
|
private:
|
||||||
void bookCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Book >& records, std::vector< std::string >& messages);
|
void bookCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Book >& records, std::vector< std::string >& messages);
|
||||||
void activatorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Activator >& records, std::vector< std::string >& messages);
|
void activatorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Activator >& records, std::vector< std::string >& messages);
|
||||||
void setSizeVariables();
|
void potionsCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Potion>& records, std::vector<std::string>& messages);
|
||||||
|
|
||||||
|
void setSizeVariables();
|
||||||
|
|
||||||
const CSMWorld::RefIdData mReferencables;
|
const CSMWorld::RefIdData mReferencables;
|
||||||
int mBooksSize;
|
int mBooksSize;
|
||||||
int mActivatorsSize;
|
int mActivatorsSize;
|
||||||
int mPotionsSize;
|
int mPotionsSize;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // REFERENCEABLECHECKSTAGE_H
|
#endif // REFERENCEABLECHECKSTAGE_H
|
||||||
|
|
Loading…
Reference in a new issue