diff options
author | Hop311 <Hop3114@gmail.com> | 2023-12-02 01:41:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 01:41:15 +0100 |
commit | cd6875d5e0ca5e2545fd0e1647678cd18a6c81c2 (patch) | |
tree | 49016457c09ef3583b200a8bd016dc702b6e298e /src/openvic-simulation/economy | |
parent | 0de3d5849cfb9faad0e3c8ce10a8152a916bba21 (diff) | |
parent | c935e471782764dcc10a3175741a02ab3ffffa8e (diff) |
Merge pull request #51 from OpenVicProject/dataloading-tech
Dataloading tech
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r-- | src/openvic-simulation/economy/Good.cpp | 18 | ||||
-rw-r--r-- | src/openvic-simulation/economy/Good.hpp | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/openvic-simulation/economy/Good.cpp b/src/openvic-simulation/economy/Good.cpp index b068644..739374b 100644 --- a/src/openvic-simulation/economy/Good.cpp +++ b/src/openvic-simulation/economy/Good.cpp @@ -95,3 +95,21 @@ bool GoodManager::load_goods_file(ast::NodeCPtr root) { lock_goods(); return ret; } + +#define GOOD_MODIFIER(name) \ + modifier_manager.register_complex_modifier(name); \ + for (Good const& good : this->get_goods()) { \ + std::string modifier_name = name; \ + modifier_name += "_"; \ + modifier_name += good.get_identifier(); \ + ret &= modifier_manager.add_modifier_effect(modifier_name, true, ModifierEffect::format_t::PROPORTION_DECIMAL); \ + } + + +bool GoodManager::generate_modifiers(ModifierManager& modifier_manager) { + bool ret = true; + GOOD_MODIFIER("factory_goods_output"); + GOOD_MODIFIER("rgo_goods_output"); + GOOD_MODIFIER("rgo_size"); + return ret; +}
\ No newline at end of file diff --git a/src/openvic-simulation/economy/Good.hpp b/src/openvic-simulation/economy/Good.hpp index faf4b66..8a239d5 100644 --- a/src/openvic-simulation/economy/Good.hpp +++ b/src/openvic-simulation/economy/Good.hpp @@ -1,5 +1,6 @@ #pragma once +#include "openvic-simulation/misc/Modifier.hpp" #include "openvic-simulation/types/IdentifierRegistry.hpp" namespace OpenVic { @@ -75,5 +76,6 @@ namespace OpenVic { void reset_to_defaults(); bool load_goods_file(ast::NodeCPtr root); + bool generate_modifiers(ModifierManager& modifier_manager); }; } |