Only check for spelllist/equipment changes in the update loop

This commit is contained in:
Evil Eye 2025-07-13 11:18:15 +02:00
parent 2dbe30ed5c
commit c80b3d26b9

View File

@ -79,6 +79,7 @@ namespace MWMechanics
bool mUpdatedHitOverlay = false; bool mUpdatedHitOverlay = false;
bool mUpdateSpellWindow = false; bool mUpdateSpellWindow = false;
bool mPlayNonLooping = false; bool mPlayNonLooping = false;
bool mEraseRemoved = false;
bool mUpdate; bool mUpdate;
UpdateContext(bool update) UpdateContext(bool update)
@ -327,6 +328,7 @@ namespace MWMechanics
const MWWorld::Ptr player = MWMechanics::getPlayer(); const MWWorld::Ptr player = MWMechanics::getPlayer();
// Update effects // Update effects
context.mEraseRemoved = true;
for (auto spellIt = mSpells.begin(); spellIt != mSpells.end();) for (auto spellIt = mSpells.begin(); spellIt != mSpells.end();)
{ {
updateActiveSpell(ptr, duration, spellIt, context); updateActiveSpell(ptr, duration, spellIt, context);
@ -411,6 +413,8 @@ namespace MWMechanics
if (removedSpell) if (removedSpell)
return true; return true;
if (context.mEraseRemoved)
{
bool remove = false; bool remove = false;
if (spellIt->hasFlag(ESM::ActiveSpells::Flag_SpellStore)) if (spellIt->hasFlag(ESM::ActiveSpells::Flag_SpellStore))
{ {
@ -451,6 +455,7 @@ namespace MWMechanics
context.mUpdateSpellWindow = true; context.mUpdateSpellWindow = true;
return true; return true;
} }
}
++spellIt; ++spellIt;
return false; return false;
} }