When a spell explodes on an actor do not apply it to that actor twice (Fixes #3142)

coverity_scan
scrawl 9 years ago
parent f315a4386f
commit 4e6a60672d

@ -521,8 +521,8 @@ namespace MWBase
virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos) = 0; virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos) = 0;
virtual void explodeSpell (const osg::Vec3f& origin, const ESM::EffectList& effects, virtual void explodeSpell (const osg::Vec3f& origin, const ESM::EffectList& effects, const MWWorld::Ptr& caster,
const MWWorld::Ptr& caster, ESM::RangeType rangeType, const std::string& id, const std::string& sourceName) = 0; const MWWorld::Ptr& ignore, ESM::RangeType rangeType, const std::string& id, const std::string& sourceName) = 0;
virtual void activate (const MWWorld::Ptr& object, const MWWorld::Ptr& actor) = 0; virtual void activate (const MWWorld::Ptr& object, const MWWorld::Ptr& actor) = 0;

@ -552,7 +552,7 @@ namespace MWMechanics
} }
if (!exploded) if (!exploded)
MWBase::Environment::get().getWorld()->explodeSpell(mHitPosition, effects, caster, range, mId, mSourceName); MWBase::Environment::get().getWorld()->explodeSpell(mHitPosition, effects, caster, target, range, mId, mSourceName);
if (!reflectedEffects.mList.empty()) if (!reflectedEffects.mList.empty())
inflict(caster, target, reflectedEffects, range, true, exploded); inflict(caster, target, reflectedEffects, range, true, exploded);

@ -237,7 +237,8 @@ namespace MWWorld
if (hit) if (hit)
{ {
MWBase::Environment::get().getWorld()->explodeSpell(pos, it->mEffects, caster, ESM::RT_Target, it->mSpellId, it->mSourceName); MWBase::Environment::get().getWorld()->explodeSpell(pos, it->mEffects, caster, result.mHitObject,
ESM::RT_Target, it->mSpellId, it->mSourceName);
MWBase::Environment::get().getSoundManager()->stopSound(it->mSound); MWBase::Environment::get().getSoundManager()->stopSound(it->mSound);
mParent->removeChild(it->mNode); mParent->removeChild(it->mNode);

@ -3072,8 +3072,8 @@ namespace MWWorld
mRendering->spawnEffect(model, textureOverride, worldPos); mRendering->spawnEffect(model, textureOverride, worldPos);
} }
void World::explodeSpell(const osg::Vec3f &origin, const ESM::EffectList &effects, const Ptr &caster, ESM::RangeType rangeType, void World::explodeSpell(const osg::Vec3f &origin, const ESM::EffectList &effects, const Ptr &caster, const Ptr& ignore,
const std::string& id, const std::string& sourceName) ESM::RangeType rangeType, const std::string& id, const std::string& sourceName)
{ {
std::map<MWWorld::Ptr, std::vector<ESM::ENAMstruct> > toApply; std::map<MWWorld::Ptr, std::vector<ESM::ENAMstruct> > toApply;
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = effects.mList.begin(); for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = effects.mList.begin();
@ -3121,6 +3121,9 @@ namespace MWWorld
if (apply->first == caster) if (apply->first == caster)
continue; continue;
if (apply->first == ignore)
continue;
if (source.isEmpty()) if (source.isEmpty())
source = apply->first; source = apply->first;

@ -623,8 +623,8 @@ namespace MWWorld
virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos); virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos);
virtual void explodeSpell (const osg::Vec3f& origin, const ESM::EffectList& effects, virtual void explodeSpell (const osg::Vec3f& origin, const ESM::EffectList& effects, const MWWorld::Ptr& caster,
const MWWorld::Ptr& caster, ESM::RangeType rangeType, const std::string& id, const std::string& sourceName); const MWWorld::Ptr& ignore, ESM::RangeType rangeType, const std::string& id, const std::string& sourceName);
virtual void activate (const MWWorld::Ptr& object, const MWWorld::Ptr& actor); virtual void activate (const MWWorld::Ptr& object, const MWWorld::Ptr& actor);

Loading…
Cancel
Save