diff options
author | hop311 <hop3114@gmail.com> | 2024-01-17 23:24:39 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-01-18 23:29:40 +0100 |
commit | e33a330129364b4bd632b2fd531a996b8c57cefb (patch) | |
tree | 88365260addebee9d3ac798d484e02ab18f56692 /src/openvic-simulation/misc/Modifier.cpp | |
parent | b5783116f67c9f7aa9d8d9653e6bda0227f67cd2 (diff) |
Parse missing variables, Logger counting, misc cleanup
Diffstat (limited to 'src/openvic-simulation/misc/Modifier.cpp')
-rw-r--r-- | src/openvic-simulation/misc/Modifier.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp index 6f6deda..e73d0e3 100644 --- a/src/openvic-simulation/misc/Modifier.cpp +++ b/src/openvic-simulation/misc/Modifier.cpp @@ -366,10 +366,10 @@ bool ModifierManager::parse_scripts(GameManager const& game_manager) { key_value_callback_t ModifierManager::_modifier_effect_callback( ModifierValue& modifier, key_value_callback_t default_callback, ModifierEffectValidator auto effect_validator ) const { - const auto add_modifier_cb = [this, &modifier, - effect_validator](ModifierEffect const* effect, ast::NodeCPtr value) -> bool { + const auto add_modifier_cb = [this, &modifier, effect_validator]( + ModifierEffect const* effect, ast::NodeCPtr value + ) -> bool { if (effect_validator(*effect)) { - static const case_insensitive_string_set_t no_effect_modifiers { "boost_strongest_party", "poor_savings_modifier", "local_artisan_input", "local_artisan_throughput", "local_artisan_output", "artisan_input", "artisan_throughput", "artisan_output", @@ -385,8 +385,9 @@ key_value_callback_t ModifierManager::_modifier_effect_callback( } }; - const auto add_flattened_modifier_cb = - [this, add_modifier_cb](std::string_view prefix, std::string_view key, ast::NodeCPtr value) -> bool { + const auto add_flattened_modifier_cb = [this, add_modifier_cb]( + std::string_view prefix, std::string_view key, ast::NodeCPtr value + ) -> bool { const std::string flat_identifier = get_flat_identifier(prefix, key); ModifierEffect const* effect = get_modifier_effect_by_identifier(flat_identifier); if (effect != nullptr) { @@ -397,7 +398,9 @@ key_value_callback_t ModifierManager::_modifier_effect_callback( } }; - return [this, default_callback, add_modifier_cb, add_flattened_modifier_cb](std::string_view key, ast::NodeCPtr value) -> bool { + return [this, default_callback, add_modifier_cb, add_flattened_modifier_cb]( + std::string_view key, ast::NodeCPtr value + ) -> bool { ModifierEffect const* effect = get_modifier_effect_by_identifier(key); if (effect != nullptr && value->is_type<ast::IdentifierNode>()) { return add_modifier_cb(effect, value); @@ -437,6 +440,7 @@ node_callback_t ModifierManager::expect_validated_modifier_value_and_default( return ret; }; } + node_callback_t ModifierManager::expect_validated_modifier_value( callback_t<ModifierValue&&> modifier_callback, ModifierEffectValidator auto effect_validator ) const { |