diff options
author | Hop311 <Hop3114@gmail.com> | 2023-12-14 01:21:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 01:21:47 +0100 |
commit | df7c04079a7b5936e1701f37a845199bac94b1fb (patch) | |
tree | 83d5a86fe04594feada3c82258d9c08624e542be /src/openvic-simulation/research/Technology.cpp | |
parent | 2e4110b26281605dde3e10f2183572d22bf773fc (diff) | |
parent | 3b6be81fb327a9c5e7bcc7c2127f513048e67480 (diff) |
Merge pull request #97 from OpenVicProject/moddable-strata
Made pop type strata moddable
Diffstat (limited to 'src/openvic-simulation/research/Technology.cpp')
-rw-r--r-- | src/openvic-simulation/research/Technology.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/openvic-simulation/research/Technology.cpp b/src/openvic-simulation/research/Technology.cpp index 3ba3624..7851707 100644 --- a/src/openvic-simulation/research/Technology.cpp +++ b/src/openvic-simulation/research/Technology.cpp @@ -143,19 +143,22 @@ bool TechnologyManager::load_technologies_file( })(root); } -#define TECH_MODIFIER(NAME, POS) ret &= modifier_manager.add_modifier_effect(NAME, POS) -#define UNCIV_TECH_MODIFIER(NAME) TECH_MODIFIER(NAME, false); TECH_MODIFIER(StringUtils::append_string_views("self_", NAME), false); -bool TechnologyManager::generate_modifiers(ModifierManager& modifier_manager) { +bool TechnologyManager::generate_modifiers(ModifierManager& modifier_manager) const { bool ret = true; - UNCIV_TECH_MODIFIER("unciv_military_modifier"); - UNCIV_TECH_MODIFIER("unciv_economic_modifier"); + const auto unciv_tech_modifier = [&modifier_manager, &ret](std::string_view name) -> void { + ret &= modifier_manager.add_modifier_effect(name, false); + ret &= modifier_manager.add_modifier_effect(StringUtils::append_string_views("self_", name), false); + }; + + unciv_tech_modifier("unciv_military_modifier"); + unciv_tech_modifier("unciv_economic_modifier"); for (TechnologyFolder const& folder : get_technology_folders()) { - TECH_MODIFIER(StringUtils::append_string_views(folder.get_identifier(), "_research_bonus"), true); + ret &= modifier_manager.add_modifier_effect( + StringUtils::append_string_views(folder.get_identifier(), "_research_bonus"), true + ); } return ret; } -#undef UNCIV_TECH_MODIFIER -#undef TECH_MODIFIER
\ No newline at end of file |