diff options
author | hop311 <hop3114@gmail.com> | 2024-10-19 12:39:08 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-10-19 12:39:08 +0200 |
commit | 572ac597d8b43c4c97be4b68aa40de0e7ae6bfe0 (patch) | |
tree | c529d60fe49fbcd167522c0fb21ca10139cb5cc7 /src/openvic-simulation/research/Invention.cpp | |
parent | 35909d6e79d524f19f9b69dffd02fcf162be5093 (diff) |
Require modifier type when parsing ModifierValues
Diffstat (limited to 'src/openvic-simulation/research/Invention.cpp')
-rw-r--r-- | src/openvic-simulation/research/Invention.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/openvic-simulation/research/Invention.cpp b/src/openvic-simulation/research/Invention.cpp index d8696a8..808dad4 100644 --- a/src/openvic-simulation/research/Invention.cpp +++ b/src/openvic-simulation/research/Invention.cpp @@ -60,7 +60,11 @@ bool InventionManager::load_inventions_file( ) { return expect_dictionary_reserve_length( inventions, [this, &modifier_manager, &unit_type_manager, &building_type_manager, &crime_manager]( - std::string_view identifier, ast::NodeCPtr value) -> bool { + std::string_view identifier, ast::NodeCPtr value + ) -> bool { + using enum Modifier::modifier_type_t; + + // TODO - use the same variable for all modifiers rather than combining them at the end? ModifierValue loose_modifiers; ModifierValue modifiers; @@ -75,12 +79,15 @@ bool InventionManager::load_inventions_file( ConditionScript limit { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; ConditionalWeight chance { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - bool ret = modifier_manager.expect_modifier_value_and_keys(move_variable_callback(loose_modifiers), + bool ret = modifier_manager.expect_modifier_value_and_keys( + move_variable_callback(loose_modifiers), + INVENTION, "news", ZERO_OR_ONE, expect_bool(assign_variable_callback(news)), "limit", ONE_EXACTLY, limit.expect_script(), "chance", ONE_EXACTLY, chance.expect_conditional_weight(ConditionalWeight::BASE), "effect", ZERO_OR_ONE, modifier_manager.expect_modifier_value_and_keys( move_variable_callback(modifiers), + INVENTION, "gas_attack", ZERO_OR_ONE, expect_bool(assign_variable_callback(unlock_gas_attack)), "gas_defence", ZERO_OR_ONE, expect_bool(assign_variable_callback(unlock_gas_defence)), "activate_unit", ZERO_OR_MORE, |