aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/economy/Good.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-12-14 00:56:20 +0100
committer hop311 <hop3114@gmail.com>2023-12-14 00:56:20 +0100
commit3b6be81fb327a9c5e7bcc7c2127f513048e67480 (patch)
tree83d5a86fe04594feada3c82258d9c08624e542be /src/openvic-simulation/economy/Good.cpp
parent35e07b57aed9177be1bfeb7732ed8f17c71f2354 (diff)
Removed modifier generating macros.
Diffstat (limited to 'src/openvic-simulation/economy/Good.cpp')
-rw-r--r--src/openvic-simulation/economy/Good.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/openvic-simulation/economy/Good.cpp b/src/openvic-simulation/economy/Good.cpp
index 5500483..44b896b 100644
--- a/src/openvic-simulation/economy/Good.cpp
+++ b/src/openvic-simulation/economy/Good.cpp
@@ -94,22 +94,22 @@ bool GoodManager::load_goods_file(ast::NodeCPtr root) {
return ret;
}
-#define GOOD_MODIFIER(name) \
- modifier_manager.register_complex_modifier(name); \
- for (Good const& good : this->get_goods()) { \
- ret &= modifier_manager.add_modifier_effect( \
- StringUtils::append_string_views(name, "_", good.get_identifier()), \
- true \
- ); \
- }
-
-bool GoodManager::generate_modifiers(ModifierManager& modifier_manager) {
+bool GoodManager::generate_modifiers(ModifierManager& modifier_manager) const {
bool ret = true;
- GOOD_MODIFIER("factory_goods_output");
- GOOD_MODIFIER("factory_goods_throughput");
- GOOD_MODIFIER("rgo_goods_output");
- GOOD_MODIFIER("rgo_size");
+
+ const auto good_modifier = [this, &modifier_manager, &ret](std::string_view name) -> void {
+ ret &= modifier_manager.register_complex_modifier(name);
+ for (Good const& good : get_goods()) {
+ ret &= modifier_manager.add_modifier_effect(
+ StringUtils::append_string_views(name, "_", good.get_identifier()), true
+ );
+ }
+ };
+
+ good_modifier("factory_goods_output");
+ good_modifier("factory_goods_throughput");
+ good_modifier("rgo_goods_output");
+ good_modifier("rgo_size");
+
return ret;
}
-
-#undef GOOD_MODIFIER \ No newline at end of file