Rename hasDisease to hasSpellType and refactor function

pull/3226/head
ζeh Matt 3 years ago
parent dcdba227f7
commit edca5ac0b8
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0

@ -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)

@ -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);

Loading…
Cancel
Save