1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-25 03:40:40 +00:00

Merge branch 'consistently_hostile' into 'master'

Clear the magic queue when unloading actors

Closes #6954

See merge request OpenMW/openmw!2317
This commit is contained in:
psi29a 2022-08-21 20:05:46 +00:00
commit 7c899364af
4 changed files with 13 additions and 5 deletions

View File

@ -498,4 +498,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

@ -144,6 +144,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

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