Make RemoveSpellEffects affect permanent spells (bug #3920)

Also make it remove the effects but not the spells themselves
pull/541/head
Capostrophic 6 years ago
parent c280a71b33
commit 6c47f95677

@ -31,6 +31,7 @@
Bug #3876: Landscape texture painting is misaligned
Bug #3897: Have Goodbye give all choices the effects of Goodbye
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters
Bug #3920: RemoveSpellEffects doesn't remove constant effects
Bug #3948: AiCombat moving target aiming uses incorrect speed for magic projectiles
Bug #3950: FLATTEN_STATIC_TRANSFORMS optimization breaks animated collision shapes
Bug #3993: Terrain texture blending map is not upscaled

@ -197,8 +197,12 @@ namespace MWMechanics
void ActiveSpells::removeEffects(const std::string &id)
{
mSpells.erase(Misc::StringUtils::lowerCase(id));
mSpellsChanged = true;
TContainer::iterator spell(mSpells.find(id));
if (spell != end());
{
spell->second.mEffects.clear();
mSpellsChanged = true;
}
}
void ActiveSpells::visitEffectSources(EffectSourceVisitor &visitor) const

@ -279,6 +279,19 @@ namespace MWMechanics
}
}
void Spells::removeEffects(const std::string &id)
{
if (isSpellActive(id))
{
TContainer::iterator spellIt = mSpells.find(getSpell(id));
for (long unsigned int i = 0; i != spellIt->first->mEffects.mList.size(); i++)
{
spellIt->second.mPurgedEffects.insert(i);
mSpellsChanged = true;
}
}
}
void Spells::visitEffectSources(EffectSourceVisitor &visitor) const
{
if (mSpellsChanged) {

@ -124,6 +124,8 @@ namespace MWMechanics
bool hasBlightDisease() const;
void removeEffects(const std::string& id);
void visitEffectSources (MWMechanics::EffectSourceVisitor& visitor) const;
void readState (const ESM::SpellState& state);

@ -501,6 +501,7 @@ namespace MWScript
runtime.pop();
ptr.getClass().getCreatureStats (ptr).getActiveSpells().removeEffects(spellid);
ptr.getClass().getCreatureStats (ptr).getSpells().removeEffects(spellid);
}
};

Loading…
Cancel
Save