1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-29 01:41:38 +00:00

Merge branch 'silencedcode' into 'master'

Remove dead code

See merge request OpenMW/openmw!4699
This commit is contained in:
Alexei Kotov 2025-06-01 23:23:35 +03:00
commit ecc9e8f5cd
4 changed files with 0 additions and 71 deletions

View file

@ -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<int> value)
{
mAiSettings[static_cast<std::underlying_type_t<AiSetting>>(index)] = value;

View file

@ -155,9 +155,6 @@ namespace MWMechanics
void setDynamic(int index, const DynamicStat<float>& 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; }

View file

@ -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)

View file

@ -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<EffectParam> 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(