1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:53:50 +00:00

disease tests

This commit is contained in:
Marc Zinnschlag 2012-11-09 18:16:29 +01:00
parent 0727d943b1
commit be1334b202
4 changed files with 46 additions and 0 deletions

View file

@ -232,4 +232,14 @@ namespace MWMechanics
mDead = false;
}
}
bool CreatureStats::hasCommonDisease() const
{
return mSpells.hasCommonDisease();
}
bool CreatureStats::hasBlightDisease() const
{
return mSpells.hasBlightDisease();
}
}

View file

@ -109,6 +109,10 @@ namespace MWMechanics
bool isDead() const;
void resurrect();
bool hasCommonDisease() const;
bool hasBlightDisease() const;
};
}

View file

@ -75,4 +75,32 @@ namespace MWMechanics
{
return mSelectedSpell;
}
bool Spells::hasCommonDisease() const
{
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
{
const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (*iter);
if (spell->mData.mFlags & ESM::Spell::ST_Disease)
return true;
}
return false;
}
bool Spells::hasBlightDisease() const
{
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
{
const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (*iter);
if (spell->mData.mFlags & ESM::Spell::ST_Blight)
return true;
}
return false;
}
}

View file

@ -55,6 +55,10 @@ namespace MWMechanics
const std::string getSelectedSpell() const;
///< May return an empty string.
bool hasCommonDisease() const;
bool hasBlightDisease() const;
};
}