1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-20 21:41:35 +00:00

Skip expensive visitEffectSources call if no summoned creatures or summon effects are active

This commit is contained in:
scrawl 2017-02-04 17:54:59 +01:00
parent ee4073541c
commit 3065600a86

View file

@ -732,12 +732,20 @@ namespace MWMechanics
} }
} }
bool hasSummonEffect = false;
for (MagicEffects::Collection::const_iterator it = effects.begin(); it != effects.end(); ++it)
if (it->first.mId >= ESM::MagicEffect::SummonScamp && it->first.mId <= ESM::MagicEffect::SummonStormAtronach)
hasSummonEffect = true;
if (!creatureStats.getSummonedCreatureMap().empty() || !creatureStats.getSummonedCreatureGraveyard().empty() || hasSummonEffect)
{
UpdateSummonedCreatures updateSummonedCreatures(ptr); UpdateSummonedCreatures updateSummonedCreatures(ptr);
creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures); creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures);
if (ptr.getClass().hasInventoryStore(ptr)) if (ptr.getClass().hasInventoryStore(ptr))
ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures); ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures);
updateSummonedCreatures.process(); updateSummonedCreatures.process();
} }
}
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration) void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration)
{ {