mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 12:41:01 +00:00
Merge branch 'activeeffect-signature-fix' into 'master'
Fix signature of MWMechanics::MagicEffects::get See merge request OpenMW/openmw!3061
This commit is contained in:
commit
fec74b7c41
@ -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…
x
Reference in New Issue
Block a user