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:
parent
dcdba227f7
commit
edca5ac0b8
2 changed files with 9 additions and 11 deletions
|
@ -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…
Reference in a new issue