aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/Rebel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/politics/Rebel.cpp')
-rw-r--r--src/openvic-simulation/politics/Rebel.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp
index fef61c0..ccaee5e 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;
@@ -96,6 +98,8 @@ bool RebelManager::load_rebels_file(
bool ret = expect_dictionary_reserve_length(
rebel_types,
[this, &ideology_manager, &government_type_manager](std::string_view identifier, ast::NodeCPtr node) -> bool {
+ using enum scope_type_t;
+
RebelType::icon_t icon = 0;
RebelType::area_t area = RebelType::area_t::ALL;
RebelType::government_map_t desired_governments;
@@ -107,11 +111,11 @@ bool RebelManager::load_rebels_file(
allow_all_religions = true, allow_all_ideologies = true, resilient = true, reinforcing = true, general = true,
smart = true, unit_transfer = false;
fixed_point_t occupation_mult = 0;
- ConditionalWeight will_rise { scope_t::POP, scope_t::COUNTRY, scope_t::NO_SCOPE };
- ConditionalWeight spawn_chance { scope_t::POP, scope_t::POP, scope_t::NO_SCOPE };
- ConditionalWeight movement_evaluation { scope_t::PROVINCE, scope_t::PROVINCE, scope_t::NO_SCOPE };
- ConditionScript siege_won_trigger { scope_t::PROVINCE, scope_t::PROVINCE, scope_t::NO_SCOPE };
- ConditionScript demands_enforced_trigger { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE };
+ ConditionalWeight will_rise { POP, COUNTRY, NO_SCOPE };
+ ConditionalWeight spawn_chance { POP, POP, NO_SCOPE };
+ ConditionalWeight movement_evaluation { PROVINCE, PROVINCE, NO_SCOPE };
+ ConditionScript siege_won_trigger { PROVINCE, PROVINCE, NO_SCOPE };
+ ConditionScript demands_enforced_trigger { COUNTRY, COUNTRY, NO_SCOPE };
EffectScript siege_won_effect, demands_enforced_effect;
bool ret = expect_dictionary_keys(
@@ -175,6 +179,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;
@@ -183,13 +188,20 @@ 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"
+ ret &= modifier_manager.register_technology_modifier_effect(
+ modifier_manager.modifier_effect_cache.rebel_org_gain_all, ModifierManager::get_flat_identifier(identifier, "all"),
+ is_positive_good, PROPORTION_DECIMAL, "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,
+ ret &= modifier_manager.register_technology_modifier_effect(
+ rebel_org_gain_effects[rebel_type], ModifierManager::get_flat_identifier(identifier, rebel_type.get_identifier()),
+ is_positive_good, PROPORTION_DECIMAL,
StringUtils::append_string_views("$", rebel_type.get_identifier(), "_title$ $TECH_REBEL_ORG_GAIN$")
);
}