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

pull/141/head
scrawl 8 years ago
parent ee4073541c
commit 3065600a86

@ -732,11 +732,19 @@ namespace MWMechanics
}
}
UpdateSummonedCreatures updateSummonedCreatures(ptr);
creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures);
if (ptr.getClass().hasInventoryStore(ptr))
ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures);
updateSummonedCreatures.process();
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);
creatureStats.getActiveSpells().visitEffectSources(updateSummonedCreatures);
if (ptr.getClass().hasInventoryStore(ptr))
ptr.getClass().getInventoryStore(ptr).visitEffectSources(updateSummonedCreatures);
updateSummonedCreatures.process();
}
}
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration)

Loading…
Cancel
Save