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/economy | |
parent | c88cf59997529cbca008f9a2b629822de9deaa2a (diff) |
contextual modifier parsingcontextual_modifier_parsing
Diffstat (limited to 'src/openvic-simulation/economy')
-rw-r--r-- | src/openvic-simulation/economy/BuildingType.cpp | 15 | ||||
-rw-r--r-- | src/openvic-simulation/economy/GoodDefinition.cpp | 4 | ||||
-rw-r--r-- | src/openvic-simulation/economy/production/ProductionType.cpp | 2 |
3 files changed, 9 insertions, 12 deletions
diff --git a/src/openvic-simulation/economy/BuildingType.cpp b/src/openvic-simulation/economy/BuildingType.cpp index a21361f..2801cfa 100644 --- a/src/openvic-simulation/economy/BuildingType.cpp +++ b/src/openvic-simulation/economy/BuildingType.cpp @@ -61,13 +61,10 @@ bool BuildingTypeManager::load_buildings_file( building_types, [this, &good_definition_manager, &production_type_manager, &modifier_manager]( std::string_view key, ast::NodeCPtr value ) -> bool { - using enum Modifier::modifier_type_t; - BuildingType::building_type_args_t building_type_args {}; - bool ret = modifier_manager.expect_modifier_value_and_keys( - move_variable_callback(building_type_args.modifier), - BUILDING, + bool ret = NodeTools::expect_dictionary_keys_and_default( + modifier_manager.expect_base_province_modifier(building_type_args.modifier), "type", ONE_EXACTLY, expect_identifier(assign_variable_callback(building_type_args.type)), "on_completion", ZERO_OR_ONE, expect_identifier(assign_variable_callback(building_type_args.on_completion)), "completion_size", ZERO_OR_ONE, @@ -131,14 +128,14 @@ bool BuildingTypeManager::load_buildings_file( static constexpr std::string_view max_prefix = "max_"; static constexpr std::string_view min_prefix = "min_build_"; - ret &= modifier_manager.add_modifier_effect( + ret &= modifier_manager.register_technology_modifier_effect( this_building_type_effects.max_level, StringUtils::append_string_views(max_prefix, building_type.get_identifier()), - true, INT, PROVINCE, StringUtils::append_string_views("$", building_type.get_identifier(), "$ $TECH_MAX_LEVEL$") + true, INT, StringUtils::append_string_views("$", building_type.get_identifier(), "$ $TECH_MAX_LEVEL$") ); // TODO - add custom localisation for "min_build_$building_type$" modifiers - ret &= modifier_manager.add_modifier_effect( + ret &= modifier_manager.register_terrain_modifier_effect( this_building_type_effects.min_level, StringUtils::append_string_views(min_prefix, building_type.get_identifier()), - false, INT, PROVINCE + false, INT ); if (building_type.is_in_province()) { diff --git a/src/openvic-simulation/economy/GoodDefinition.cpp b/src/openvic-simulation/economy/GoodDefinition.cpp index f8bd9b7..7ad5a87 100644 --- a/src/openvic-simulation/economy/GoodDefinition.cpp +++ b/src/openvic-simulation/economy/GoodDefinition.cpp @@ -118,9 +118,9 @@ bool GoodDefinitionManager::generate_modifiers(ModifierManager& modifier_manager ModifierEffect const*& effect_cache, std::string_view name, bool is_positive_good, std::string_view localisation_key ) -> void { - ret &= modifier_manager.add_modifier_effect( + ret &= modifier_manager.register_technology_modifier_effect( effect_cache, ModifierManager::get_flat_identifier(name, good_identifier), is_positive_good, - PROPORTION_DECIMAL, COUNTRY, localisation_key + PROPORTION_DECIMAL, localisation_key ); }; diff --git a/src/openvic-simulation/economy/production/ProductionType.cpp b/src/openvic-simulation/economy/production/ProductionType.cpp index 65f3eba..7c4dfef 100644 --- a/src/openvic-simulation/economy/production/ProductionType.cpp +++ b/src/openvic-simulation/economy/production/ProductionType.cpp @@ -60,7 +60,7 @@ node_callback_t ProductionTypeManager::_expect_job( using enum Job::effect_t; std::string_view pop_type {}; - Job::effect_t effect_type {THROUGHPUT}; + Job::effect_t effect_type { THROUGHPUT }; fixed_point_t effect_multiplier = 1, desired_workforce_share = 1; static const string_map_t<Job::effect_t> effect_map = { |