diff options
Diffstat (limited to 'src/openvic-simulation/pop/Pop.cpp')
-rw-r--r-- | src/openvic-simulation/pop/Pop.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index 88ea69a..39deeaa 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -219,21 +219,22 @@ bool PopManager::load_pop_into_vector( return ret; } -#define STRATA_MODIFIER(name, positive_good) \ - ret &= modifier_manager.add_modifier_effect(StringUtils::append_string_views(strata.get_identifier(), name), positive_good) - -bool PopManager::generate_modifiers(ModifierManager& modifier_manager) { +bool PopManager::generate_modifiers(ModifierManager& modifier_manager) const { bool ret = true; for (Strata const& strata : get_stratas()) { - STRATA_MODIFIER("_income_modifier", true); - STRATA_MODIFIER("_savings_modifier", true); - STRATA_MODIFIER("_vote", true); - - STRATA_MODIFIER("_life_needs", false); - STRATA_MODIFIER("_everyday_needs", false); - STRATA_MODIFIER("_luxury_needs", false); + const auto strata_modifier = [&modifier_manager, &ret, &strata](std::string_view suffix, bool positive_good) -> void { + ret &= modifier_manager.add_modifier_effect( + StringUtils::append_string_views(strata.get_identifier(), suffix), positive_good + ); + }; + + strata_modifier("_income_modifier", true); + strata_modifier("_savings_modifier", true); + strata_modifier("_vote", true); + + strata_modifier("_life_needs", false); + strata_modifier("_everyday_needs", false); + strata_modifier("_luxury_needs", false); } return ret; } - -#undef STRATA_MODIFIER |