diff options
Diffstat (limited to 'src/openvic-simulation/modifier/ModifierSum.cpp')
-rw-r--r-- | src/openvic-simulation/modifier/ModifierSum.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/openvic-simulation/modifier/ModifierSum.cpp b/src/openvic-simulation/modifier/ModifierSum.cpp index 09cb36d..a3b8cd5 100644 --- a/src/openvic-simulation/modifier/ModifierSum.cpp +++ b/src/openvic-simulation/modifier/ModifierSum.cpp @@ -70,23 +70,28 @@ void ModifierSum::add_modifier_sum_exclude_source(ModifierSum const& modifier_su } // TODO - include value_sum[effect] in result? Early return if lookup in value_sum fails? -std::vector<ModifierSum::modifier_entry_t> ModifierSum::get_contributing_modifiers( - ModifierEffect const& effect + +void ModifierSum::push_contributing_modifiers( + ModifierEffect const& effect, std::vector<modifier_entry_t>& contributions ) const { using enum ModifierEffect::target_t; - std::vector<modifier_entry_t> ret; - for (modifier_entry_t const& modifier_entry : modifiers) { if ((modifier_entry.targets & effect.get_targets()) != NO_TARGETS) { bool effect_found = false; const fixed_point_t value = modifier_entry.modifier->get_effect(effect, &effect_found); if (effect_found) { - ret.push_back(modifier_entry); + contributions.push_back(modifier_entry); } } } +} + +std::vector<ModifierSum::modifier_entry_t> ModifierSum::get_contributing_modifiers(ModifierEffect const& effect) const { + std::vector<modifier_entry_t> contributions; + + push_contributing_modifiers(effect, contributions); - return ret; + return contributions; } |