Fix signature of MWMechanics::MagicEffects::get. Fix a mistake in the docs.

simplify_debugging
Mads Buvik Sandvei 2 years ago
parent 03ff03005d
commit 85a30c9ad0

@ -564,10 +564,9 @@ namespace MWLua
key = MWMechanics::EffectKey(id, ESM::Skill::stringToSkillId(argStr.value()));
}
std::optional<MWMechanics::EffectParam> param;
if (auto* store = effects.getStore())
if (store->get(key, param))
return ActiveEffect{ key, param.value() };
if (auto effect = store->get(key))
return ActiveEffect{ key, effect.value() };
return sol::nullopt;
};
}

@ -158,21 +158,18 @@ namespace MWMechanics
EffectParam MagicEffects::getOrDefault(const EffectKey& key) const
{
std::optional<EffectParam> param;
get(key, param);
return param.value_or(EffectParam());
return get(key).value_or(EffectParam());
}
bool MagicEffects::get(const EffectKey& key, std::optional<EffectParam>& param) const
std::optional<EffectParam> MagicEffects::get(const EffectKey& key) const
{
Collection::const_iterator iter = mCollection.find(key);
if (iter != mCollection.end())
{
param = iter->second;
return true;
return iter->second;
}
return false;
return std::nullopt;
}
MagicEffects MagicEffects::diff(const MagicEffects& prev, const MagicEffects& now)

@ -106,7 +106,7 @@ namespace MWMechanics
void setModifiers(const MagicEffects& effects);
EffectParam getOrDefault(const EffectKey& key) const;
bool get(const EffectKey& key, std::optional<EffectParam>& param) 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);

@ -595,7 +595,6 @@
---
-- @type ActiveEffect
-- @field #ActiveEffect effect @{#ActiveEffect}
-- @field #any affectedSkill @{#SKILL} or nil
-- @field #any affectedAttribute @{#ATTRIBUTE} or nil
-- @field #string id Effect id string

Loading…
Cancel
Save