1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-26 00:39:42 +00:00

Merge branch 'consistently_hostile' into 'master'

Clear the magic queue when unloading actors

Closes #6954

See merge request OpenMW/openmw!2317

(cherry picked from commit 7c899364af)

afcbb3cb Clear the magic queue when unloading actors
443420ea CI compare cells
This commit is contained in:
psi29a 2022-08-21 20:05:46 +00:00
parent d262ca2d30
commit 2795097907
4 changed files with 13 additions and 5 deletions

View file

@ -497,4 +497,13 @@ namespace MWMechanics
for(const ESM::ActiveSpells::ActiveSpellParams& spell : state.mQueue)
mQueue.emplace_back(ActiveSpellParams{spell});
}
void ActiveSpells::unloadActor(const MWWorld::Ptr& ptr)
{
purge([] (const auto& spell)
{
return spell.getType() == ESM::ActiveSpells::Type_Consumable || spell.getType() == ESM::ActiveSpells::Type_Temporary;
}, ptr);
mQueue.clear();
}
}

View file

@ -145,6 +145,8 @@ namespace MWMechanics
///< case insensitive
void skipWorsenings(double hours);
void unloadActor(const MWWorld::Ptr& ptr);
};
}

View file

@ -220,10 +220,7 @@ void soulTrap(const MWWorld::Ptr& creature)
void removeTemporaryEffects(const MWWorld::Ptr& ptr)
{
ptr.getClass().getCreatureStats(ptr).getActiveSpells().purge([] (const auto& spell)
{
return spell.getType() == ESM::ActiveSpells::Type_Consumable || spell.getType() == ESM::ActiveSpells::Type_Temporary;
}, ptr);
ptr.getClass().getCreatureStats(ptr).getActiveSpells().unloadActor(ptr);
}
}

View file

@ -972,7 +972,7 @@ namespace MWWorld
mPhysics->clearQueuedMovement();
mDiscardMovements = true;
if (changeEvent && mCurrentWorldSpace != cellName)
if (changeEvent && !Misc::StringUtils::ciEqual(mCurrentWorldSpace, cellName))
{
// changed worldspace
mProjectileManager->clear();