diff options
author | Hop311 <Hop3114@gmail.com> | 2024-10-20 20:44:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-20 20:44:51 +0200 |
commit | 6527f832a5e14a28fc1f5b85628541038eb90141 (patch) | |
tree | aca829171be7b1144cb3ca29510593fa8a84af24 /src/openvic-simulation/politics/Rebel.cpp | |
parent | 9a84e7af70f2528578b00879e568bca285563e9b (diff) | |
parent | 5194a3d043db66b81470111a94f3b1cdf8d42176 (diff) |
Merge pull request #198 from OpenVicProject/resultant-modifier
Calculate country and province modifier sums
Diffstat (limited to 'src/openvic-simulation/politics/Rebel.cpp')
-rw-r--r-- | src/openvic-simulation/politics/Rebel.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp index fef61c0..9bba1b9 100644 --- a/src/openvic-simulation/politics/Rebel.cpp +++ b/src/openvic-simulation/politics/Rebel.cpp @@ -2,6 +2,8 @@ #include <string_view> +#include "openvic-simulation/modifier/ModifierManager.hpp" + using namespace OpenVic; using namespace OpenVic::NodeTools; @@ -175,6 +177,7 @@ bool RebelManager::load_rebels_file( bool RebelManager::generate_modifiers(ModifierManager& modifier_manager) const { using enum ModifierEffect::format_t; + using enum ModifierEffect::target_t; bool ret = true; @@ -184,12 +187,19 @@ bool RebelManager::generate_modifiers(ModifierManager& modifier_manager) const { ret &= modifier_manager.register_complex_modifier(identifier); ret &= modifier_manager.add_modifier_effect( - ModifierManager::get_flat_identifier(identifier, "all"), is_positive_good, PROPORTION_DECIMAL, "TECH_REBEL_ORG_GAIN" + modifier_manager.modifier_effect_cache.rebel_org_gain_all, ModifierManager::get_flat_identifier(identifier, "all"), + is_positive_good, PROPORTION_DECIMAL, COUNTRY, "TECH_REBEL_ORG_GAIN" ); + IndexedMap<RebelType, ModifierEffect const*>& rebel_org_gain_effects = + modifier_manager.modifier_effect_cache.rebel_org_gain_effects; + + rebel_org_gain_effects.set_keys(&get_rebel_types()); + for (RebelType const& rebel_type : get_rebel_types()) { ret &= modifier_manager.add_modifier_effect( - ModifierManager::get_flat_identifier(identifier, rebel_type.get_identifier()), is_positive_good, PROPORTION_DECIMAL, + rebel_org_gain_effects[rebel_type], ModifierManager::get_flat_identifier(identifier, rebel_type.get_identifier()), + is_positive_good, PROPORTION_DECIMAL, COUNTRY, StringUtils::append_string_views("$", rebel_type.get_identifier(), "_title$ $TECH_REBEL_ORG_GAIN$") ); } |