diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-10-21 14:09:40 +0200 |
---|---|---|
committer | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-10-26 16:49:08 +0200 |
commit | 3daebe5db14949f55be2c50220323138260dbaea (patch) | |
tree | 46039d0eb5d630cf000e94aed584aebaaa8f3f9b /src/openvic-simulation/research/Technology.cpp | |
parent | c88cf59997529cbca008f9a2b629822de9deaa2a (diff) |
contextual modifier parsingcontextual_modifier_parsing
Diffstat (limited to 'src/openvic-simulation/research/Technology.cpp')
-rw-r--r-- | src/openvic-simulation/research/Technology.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/openvic-simulation/research/Technology.cpp b/src/openvic-simulation/research/Technology.cpp index a770a40..9a1cf27 100644 --- a/src/openvic-simulation/research/Technology.cpp +++ b/src/openvic-simulation/research/Technology.cpp @@ -142,12 +142,10 @@ bool TechnologyManager::load_technology_file_schools( const bool ret = expect_dictionary_reserve_length( technology_schools, [this, &modifier_manager](std::string_view school_key, ast::NodeCPtr school_value) -> bool { - using enum Modifier::modifier_type_t; - ModifierValue modifiers; - bool ret = modifier_manager.expect_modifier_value( - move_variable_callback(modifiers), TECH_SCHOOL + bool ret = NodeTools::expect_dictionary( + modifier_manager.expect_base_country_modifier(modifiers) )(school_value); ret &= add_technology_school(school_key, std::move(modifiers)); @@ -170,8 +168,6 @@ bool TechnologyManager::load_technologies_file( return expect_dictionary_reserve_length(technologies, [this, &modifier_manager, &unit_type_manager, &building_type_manager]( std::string_view tech_key, ast::NodeCPtr tech_value ) -> bool { - using enum Modifier::modifier_type_t; - ModifierValue modifiers; TechnologyArea const* area = nullptr; Date::year_t year = 0; @@ -182,9 +178,8 @@ bool TechnologyManager::load_technologies_file( Technology::building_set_t activated_buildings; ConditionalWeight ai_chance { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - bool ret = modifier_manager.expect_modifier_value_and_keys( - move_variable_callback(modifiers), - TECHNOLOGY, + bool ret = NodeTools::expect_dictionary_keys_and_default( + modifier_manager.expect_technology_modifier(modifiers), "area", ONE_EXACTLY, expect_technology_area_identifier(assign_variable_callback_pointer(area)), "year", ONE_EXACTLY, expect_uint(assign_variable_callback(year)), "cost", ONE_EXACTLY, expect_fixed_point(assign_variable_callback(cost)), @@ -219,8 +214,8 @@ bool TechnologyManager::generate_modifiers(ModifierManager& modifier_manager) co for (TechnologyFolder const& folder : get_technology_folders()) { const std::string modifier_identifier = StringUtils::append_string_views(folder.get_identifier(), "_research_bonus"); - ret &= modifier_manager.add_modifier_effect( - research_bonus_effects[folder], modifier_identifier, true, PROPORTION_DECIMAL, COUNTRY, modifier_identifier + ret &= modifier_manager.register_base_country_modifier_effect( + research_bonus_effects[folder], modifier_identifier, true, PROPORTION_DECIMAL, modifier_identifier ); } |