diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index b18bca98d5..41af96a630 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -193,15 +193,6 @@ namespace MWMechanics mLevel = level; } - void CreatureStats::modifyMagicEffects(const MagicEffects& effects) - { - bool recalc = effects.getOrDefault(ESM::MagicEffect::FortifyMaximumMagicka).getModifier() - != mMagicEffects.getOrDefault(ESM::MagicEffect::FortifyMaximumMagicka).getModifier(); - mMagicEffects.setModifiers(effects); - if (recalc) - recalculateMagicka(); - } - void CreatureStats::setAiSetting(AiSetting index, Stat value) { mAiSettings[static_cast>(index)] = value; diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index f65e1a000f..02312385d7 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -155,9 +155,6 @@ namespace MWMechanics void setDynamic(int index, const DynamicStat& value); - /// Set Modifier for each magic effect according to \a effects. Does not touch Base values. - void modifyMagicEffects(const MagicEffects& effects); - void setAttackingOrSpell(bool attackingOrSpell) { mAttackingOrSpell = attackingOrSpell; } void setAttackType(std::string_view attackType) { mAttackType = attackType; } diff --git a/apps/openmw/mwmechanics/magiceffects.cpp b/apps/openmw/mwmechanics/magiceffects.cpp index c2afef7c0d..e4210ed8fc 100644 --- a/apps/openmw/mwmechanics/magiceffects.cpp +++ b/apps/openmw/mwmechanics/magiceffects.cpp @@ -121,11 +121,6 @@ namespace MWMechanics return *this; } - void MagicEffects::remove(const EffectKey& key) - { - mCollection.erase(key); - } - void MagicEffects::add(const EffectKey& key, const EffectParam& param) { Collection::iterator iter = mCollection.find(key); @@ -145,19 +140,6 @@ namespace MWMechanics mCollection[key].modifyBase(diff); } - void MagicEffects::setModifiers(const MagicEffects& effects) - { - for (Collection::iterator it = mCollection.begin(); it != mCollection.end(); ++it) - { - it->second.setModifier(effects.getOrDefault(it->first).getModifier()); - } - - for (Collection::const_iterator it = effects.begin(); it != effects.end(); ++it) - { - mCollection[it->first].setModifier(it->second.getModifier()); - } - } - EffectParam MagicEffects::getOrDefault(const EffectKey& key) const { return get(key).value_or(EffectParam()); @@ -174,40 +156,6 @@ namespace MWMechanics return std::nullopt; } - MagicEffects MagicEffects::diff(const MagicEffects& prev, const MagicEffects& now) - { - MagicEffects result; - - // adding/changing - for (Collection::const_iterator iter(now.begin()); iter != now.end(); ++iter) - { - Collection::const_iterator other = prev.mCollection.find(iter->first); - - if (other == prev.end()) - { - // adding - result.add(iter->first, iter->second); - } - else - { - // changing - result.add(iter->first, iter->second - other->second); - } - } - - // removing - for (Collection::const_iterator iter(prev.begin()); iter != prev.end(); ++iter) - { - Collection::const_iterator other = now.mCollection.find(iter->first); - if (other == now.end()) - { - result.add(iter->first, EffectParam() - iter->second); - } - } - - return result; - } - void MagicEffects::writeState(ESM::MagicEffects& state) const { for (const auto& [key, params] : mCollection) diff --git a/apps/openmw/mwmechanics/magiceffects.hpp b/apps/openmw/mwmechanics/magiceffects.hpp index 4fe5d9fd4e..80b858644e 100644 --- a/apps/openmw/mwmechanics/magiceffects.hpp +++ b/apps/openmw/mwmechanics/magiceffects.hpp @@ -103,19 +103,12 @@ namespace MWMechanics void writeState(ESM::MagicEffects& state) const; void add(const EffectKey& key, const EffectParam& param); - void remove(const EffectKey& key); void modifyBase(const EffectKey& key, int diff); - /// Copy Modifier values from \a effects, but keep original mBase values. - void setModifiers(const MagicEffects& effects); - EffectParam getOrDefault(const EffectKey& key) const; std::optional get(const EffectKey& key) const; ///< This function can safely be used for keys that are not present. - - static MagicEffects diff(const MagicEffects& prev, const MagicEffects& now); - ///< Return changes from \a prev to \a now. }; std::string getMagicEffectString(