diff options
Diffstat (limited to 'src/openvic-simulation/Modifier.hpp')
-rw-r--r-- | src/openvic-simulation/Modifier.hpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/openvic-simulation/Modifier.hpp b/src/openvic-simulation/Modifier.hpp index f88102b..2e1b03a 100644 --- a/src/openvic-simulation/Modifier.hpp +++ b/src/openvic-simulation/Modifier.hpp @@ -92,33 +92,39 @@ 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, - 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(); bool add_modifier_effect(std::string_view identifier, bool province_good); - IDENTIFIER_REGISTRY_ACCESSORS(ModifierEffect, modifier_effect) + IDENTIFIER_REGISTRY_ACCESSORS(modifier_effect) bool add_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon); - IDENTIFIER_REGISTRY_ACCESSORS(Modifier, modifier) + IDENTIFIER_REGISTRY_ACCESSORS(modifier) bool setup_modifier_effects(); - NodeTools::node_callback_t expect_modifier_value(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback) const; + NodeTools::node_callback_t expect_modifier_value_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback) const; + NodeTools::node_callback_t expect_modifier_value(NodeTools::callback_t<ModifierValue&&> modifier_callback) const; + + NodeTools::node_callback_t expect_modifier_value_and_key_map_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback, NodeTools::key_map_t&& key_map) const; + NodeTools::node_callback_t expect_modifier_value_and_key_map(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_map_t&& key_map) const; template<typename... Args> + NodeTools::node_callback_t expect_modifier_value_and_key_map_and_default( + NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback, NodeTools::key_map_t&& key_map, + 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_key_map_and_default(modifier_callback, default_callback, std::move(key_map), args...); + } + + template<typename... Args> + NodeTools::node_callback_t expect_modifier_value_and_keys_and_default(NodeTools::callback_t<ModifierValue&&> modifier_callback, NodeTools::key_value_callback_t default_callback, Args... args) const { + return expect_modifier_value_and_key_map_and_default(modifier_callback, default_callback, {}, args...); + } + 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...); + return expect_modifier_value_and_key_map_and_default(modifier_callback, NodeTools::key_value_invalid_callback, {}, args...); } }; } |