mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 07:06:45 +00:00
Remove active effects from spells that no longer exist
This commit is contained in:
parent
7af245d205
commit
3d5950f790
1 changed files with 13 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
#include "activespells.hpp"
|
#include "activespells.hpp"
|
||||||
|
|
||||||
|
#include <components/debug/debuglog.hpp>
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
|
@ -234,7 +236,17 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool remove = false;
|
bool remove = false;
|
||||||
if(spellIt->mType == ESM::ActiveSpells::Type_Ability || spellIt->mType == ESM::ActiveSpells::Type_Permanent)
|
if(spellIt->mType == ESM::ActiveSpells::Type_Ability || spellIt->mType == ESM::ActiveSpells::Type_Permanent)
|
||||||
remove = !spells.hasSpell(spellIt->mId);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
remove = !spells.hasSpell(spellIt->mId);
|
||||||
|
}
|
||||||
|
catch(const std::runtime_error& e)
|
||||||
|
{
|
||||||
|
remove = true;
|
||||||
|
Log(Debug::Error) << "Removing active effect: " << e.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(spellIt->mType == ESM::ActiveSpells::Type_Enchantment)
|
else if(spellIt->mType == ESM::ActiveSpells::Type_Enchantment)
|
||||||
{
|
{
|
||||||
const auto& store = ptr.getClass().getInventoryStore(ptr);
|
const auto& store = ptr.getClass().getInventoryStore(ptr);
|
||||||
|
|
Loading…
Reference in a new issue