mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-26 10:39:43 +00:00
Clear the magic queue when unloading actors
This commit is contained in:
parent
510eac3fb4
commit
afcbb3cb5e
3 changed files with 12 additions and 4 deletions
|
@ -498,4 +498,13 @@ namespace MWMechanics
|
||||||
for(const ESM::ActiveSpells::ActiveSpellParams& spell : state.mQueue)
|
for(const ESM::ActiveSpells::ActiveSpellParams& spell : state.mQueue)
|
||||||
mQueue.emplace_back(ActiveSpellParams{spell});
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,6 +144,8 @@ namespace MWMechanics
|
||||||
///< case insensitive
|
///< case insensitive
|
||||||
|
|
||||||
void skipWorsenings(double hours);
|
void skipWorsenings(double hours);
|
||||||
|
|
||||||
|
void unloadActor(const MWWorld::Ptr& ptr);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,10 +220,7 @@ void soulTrap(const MWWorld::Ptr& creature)
|
||||||
|
|
||||||
void removeTemporaryEffects(const MWWorld::Ptr& ptr)
|
void removeTemporaryEffects(const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
ptr.getClass().getCreatureStats(ptr).getActiveSpells().purge([] (const auto& spell)
|
ptr.getClass().getCreatureStats(ptr).getActiveSpells().unloadActor(ptr);
|
||||||
{
|
|
||||||
return spell.getType() == ESM::ActiveSpells::Type_Consumable || spell.getType() == ESM::ActiveSpells::Type_Temporary;
|
|
||||||
}, ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue