From 4af376133b9b825960a5cb0fb7cdd0a9c14087c1 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 15 Dec 2015 20:41:00 +0100 Subject: [PATCH] Don't tick effects when duration is zero --- apps/openmw/mwmechanics/actors.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 185364fae7..58fedf2fd9 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -486,14 +486,17 @@ namespace MWMechanics bool wasDead = creatureStats.isDead(); - for (MagicEffects::Collection::const_iterator it = effects.begin(); it != effects.end(); ++it) + if (duration > 0) { - // tickable effects (i.e. effects having a lasting impact after expiry) - effectTick(creatureStats, ptr, it->first, it->second.getMagnitude() * duration); + for (MagicEffects::Collection::const_iterator it = effects.begin(); it != effects.end(); ++it) + { + // tickable effects (i.e. effects having a lasting impact after expiry) + effectTick(creatureStats, ptr, it->first, it->second.getMagnitude() * duration); - // instant effects are already applied on spell impact in spellcasting.cpp, but may also come from permanent abilities - CastSpell cast(ptr, ptr); - cast.applyInstantEffect(ptr, ptr, it->first, it->second.getMagnitude()); + // instant effects are already applied on spell impact in spellcasting.cpp, but may also come from permanent abilities + CastSpell cast(ptr, ptr); + cast.applyInstantEffect(ptr, ptr, it->first, it->second.getMagnitude()); + } } // attributes