mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Merge pull request #2387 from Capostrophic/spells
Don't break GetSpellEffects execution if the spell doesn't exist
This commit is contained in:
commit
316c79fecd
1 changed files with 8 additions and 6 deletions
|
@ -185,14 +185,16 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool Spells::isSpellActive(const std::string &id) const
|
bool Spells::isSpellActive(const std::string &id) const
|
||||||
{
|
{
|
||||||
TContainer::const_iterator found = mSpells.find(getSpell(id));
|
if (id.empty())
|
||||||
if (found != mSpells.end())
|
return false;
|
||||||
{
|
|
||||||
const ESM::Spell *spell = found->first;
|
|
||||||
|
|
||||||
return (spell->mData.mType==ESM::Spell::ST_Ability || spell->mData.mType==ESM::Spell::ST_Blight ||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(id);
|
||||||
spell->mData.mType==ESM::Spell::ST_Disease || spell->mData.mType==ESM::Spell::ST_Curse);
|
if (spell && hasSpell(spell))
|
||||||
|
{
|
||||||
|
auto type = spell->mData.mType;
|
||||||
|
return (type==ESM::Spell::ST_Ability || type==ESM::Spell::ST_Blight || type==ESM::Spell::ST_Disease || type==ESM::Spell::ST_Curse);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue