diff options
author | hop311 <hop3114@gmail.com> | 2024-10-01 00:23:35 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-10-05 22:48:42 +0200 |
commit | ba4fe5d9a8596e1b73a3aa0735d471e25493d54b (patch) | |
tree | a760bb0c72e6ab2f135f7d003391a1f1f9245753 /src/openvic-simulation/politics/Rebel.cpp | |
parent | f3f364f08cc8f1c80a5dfce689183c2f8f75bbd4 (diff) |
Cache modifier effects in dedicated variables
Diffstat (limited to 'src/openvic-simulation/politics/Rebel.cpp')
-rw-r--r-- | src/openvic-simulation/politics/Rebel.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp index ea443db..219a47b 100644 --- a/src/openvic-simulation/politics/Rebel.cpp +++ b/src/openvic-simulation/politics/Rebel.cpp @@ -187,14 +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, COUNTRY, - "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, COUNTRY, + 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$") ); } |