mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 04:15:31 +00:00
Skip expensive visitEffectSources call if no summoned creatures or summon effects are active
This commit is contained in:
parent
ee4073541c
commit
3065600a86
1 changed files with 13 additions and 5 deletions
|
@ -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…
Reference in a new issue