diff options
author | hop311 <hop3114@gmail.com> | 2023-12-14 00:56:20 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-12-14 00:56:20 +0100 |
commit | 3b6be81fb327a9c5e7bcc7c2127f513048e67480 (patch) | |
tree | 83d5a86fe04594feada3c82258d9c08624e542be /src/openvic-simulation/research/Technology.cpp | |
parent | 35e07b57aed9177be1bfeb7732ed8f17c71f2354 (diff) |
Removed modifier generating macros.
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 |