1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 14:45:35 +00:00

Rename hasDisease to hasSpellType and refactor function

This commit is contained in:
ζeh Matt 2022-03-25 20:47:43 +02:00
parent dcdba227f7
commit edca5ac0b8
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0
2 changed files with 9 additions and 11 deletions

View file

@ -112,25 +112,23 @@ namespace MWMechanics
return mSelectedSpell;
}
bool Spells::hasDisease(const ESM::Spell::SpellType type) const
bool Spells::hasSpellType(const ESM::Spell::SpellType type) const
{
for (const auto spell : mSpells)
{
if (spell->mData.mType == type)
return true;
}
return false;
auto it = std::find_if(std::begin(mSpells), std::end(mSpells), [=](const ESM::Spell* spell)
{
return spell->mData.mType == type;
});
return it != std::end(mSpells);
}
bool Spells::hasCommonDisease() const
{
return hasDisease(ESM::Spell::ST_Disease);
return hasSpellType(ESM::Spell::ST_Disease);
}
bool Spells::hasBlightDisease() const
{
return hasDisease(ESM::Spell::ST_Blight);
return hasSpellType(ESM::Spell::ST_Blight);
}
void Spells::purge(const SpellFilter& filter)

View file

@ -36,7 +36,7 @@ namespace MWMechanics
std::vector<std::pair<const ESM::Spell*, MWWorld::TimeStamp>> mUsedPowers;
bool hasDisease(const ESM::Spell::SpellType type) const;
bool hasSpellType(const ESM::Spell::SpellType type) const;
using SpellFilter = bool (*)(const ESM::Spell*);
void purge(const SpellFilter& filter);