aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r--src/openvic-simulation/pop/Pop.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp
index dd829d9..885903a 100644
--- a/src/openvic-simulation/pop/Pop.cpp
+++ b/src/openvic-simulation/pop/Pop.cpp
@@ -5,6 +5,7 @@
#include "openvic-simulation/map/ProvinceInstance.hpp"
#include "openvic-simulation/military/UnitType.hpp"
#include "openvic-simulation/misc/Define.hpp"
+#include "openvic-simulation/modifier/ModifierManager.hpp"
#include "openvic-simulation/politics/Ideology.hpp"
#include "openvic-simulation/politics/Issue.hpp"
#include "openvic-simulation/politics/Rebel.hpp"
@@ -654,24 +655,33 @@ bool PopManager::load_pop_bases_into_vector(
bool PopManager::generate_modifiers(ModifierManager& modifier_manager) const {
using enum ModifierEffect::format_t;
+ using enum ModifierEffect::target_t;
+
+ IndexedMap<Strata, ModifierEffectCache::strata_effects_t>& strata_effects =
+ modifier_manager.modifier_effect_cache.strata_effects;
+
+ strata_effects.set_keys(&get_stratas());
bool ret = true;
for (Strata const& strata : get_stratas()) {
const auto strata_modifier = [&modifier_manager, &ret, &strata](
- std::string_view suffix, bool is_positive_good
+ ModifierEffect const*& effect_cache, std::string_view suffix, bool is_positive_good
) -> void {
ret &= modifier_manager.add_modifier_effect(
- StringUtils::append_string_views(strata.get_identifier(), suffix), is_positive_good
+ effect_cache, StringUtils::append_string_views(strata.get_identifier(), suffix), is_positive_good,
+ PROPORTION_DECIMAL, COUNTRY
);
};
- strata_modifier("_income_modifier", true);
- strata_modifier("_vote", true);
+ ModifierEffectCache::strata_effects_t& this_strata_effects = strata_effects[strata];
+
+ strata_modifier(this_strata_effects.income_modifier, "_income_modifier", true); // Has no effect in game
+ strata_modifier(this_strata_effects.vote, "_vote", true);
- strata_modifier("_life_needs", false);
- strata_modifier("_everyday_needs", false);
- strata_modifier("_luxury_needs", false);
+ strata_modifier(this_strata_effects.life_needs, "_life_needs", false);
+ strata_modifier(this_strata_effects.everyday_needs, "_everyday_needs", false);
+ strata_modifier(this_strata_effects.luxury_needs, "_luxury_needs", false);
}
return ret;