diff options
author | Hop311 <Hop3114@gmail.com> | 2023-09-26 18:15:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 18:15:43 +0200 |
commit | ca3996510ed6e26a81c781992d33c335ca250a16 (patch) | |
tree | e456ce0a8355ae2936d78a99b6c77ef785a8e5d5 /src/openvic-simulation/Modifier.hpp | |
parent | 63e462fceff981f79bcbae53e8d90fc59733e8c2 (diff) | |
parent | 1c7b3239ab4e9f75d0605e5da852daf5afaa8c4a (diff) |
Merge pull request #35 from OpenVicProject/expect-modifier-keys
Expect modifier value + keys function
Diffstat (limited to 'src/openvic-simulation/Modifier.hpp')
-rw-r--r-- | src/openvic-simulation/Modifier.hpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/openvic-simulation/Modifier.hpp b/src/openvic-simulation/Modifier.hpp index ea302b2..bfd9ca7 100644 --- a/src/openvic-simulation/Modifier.hpp +++ b/src/openvic-simulation/Modifier.hpp @@ -92,6 +92,17 @@ namespace OpenVic { IdentifierRegistry<ModifierEffect> modifier_effects; IdentifierRegistry<Modifier> modifiers; + NodeTools::node_callback_t _expect_modifier_value_and_keys(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_map_t&& key_map) const; + + template<typename... Args> + NodeTools::node_callback_t _expect_modifier_value_and_keys( + NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_map_t&& key_map, + const std::string_view key, NodeTools::dictionary_entry_t::expected_count_t expected_count, NodeTools::node_callback_t callback, + Args... args) const { + NodeTools::add_key_map_entry(key_map, key, expected_count, callback); + return _expect_modifier_value_and_keys(modifier_callback, std::move(key_map), args...); + } + public: ModifierManager(); @@ -103,6 +114,11 @@ namespace OpenVic { bool setup_modifier_effects(); - NodeTools::node_callback_t expect_modifier_value(NodeTools::callback_t<ModifierValue&&> callback, NodeTools::key_value_callback_t default_callback) const; + NodeTools::node_callback_t expect_modifier_value(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback) const; + + template<typename... Args> + NodeTools::node_callback_t expect_modifier_value_and_keys(NodeTools::callback_t<ModifierValue&&> modifier_callback, Args... args) const { + return _expect_modifier_value_and_keys(modifier_callback, {}, args...); + } }; } |