diff options
author | hop311 <hop3114@gmail.com> | 2024-06-08 01:17:25 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-06-08 01:17:25 +0200 |
commit | c0ba822ee46551a40ad6b43e8f56b80e27ae35b5 (patch) | |
tree | ebc9c03b5bd0a6b11068ac37aca302f6ceb24a18 /src/openvic-simulation/politics/NationalFocus.cpp | |
parent | 1198a780916e65cae048dd3478f614c1d18db846 (diff) |
Add GoodInstancegood-instance
Diffstat (limited to 'src/openvic-simulation/politics/NationalFocus.cpp')
-rw-r--r-- | src/openvic-simulation/politics/NationalFocus.cpp | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/src/openvic-simulation/politics/NationalFocus.cpp b/src/openvic-simulation/politics/NationalFocus.cpp index 22b91b2..a62147f 100644 --- a/src/openvic-simulation/politics/NationalFocus.cpp +++ b/src/openvic-simulation/politics/NationalFocus.cpp @@ -72,8 +72,8 @@ inline bool NationalFocusManager::add_national_focus( } bool NationalFocusManager::load_national_foci_file( - PopManager const& pop_manager, IdeologyManager const& ideology_manager, GoodManager const& good_manager, - ModifierManager const& modifier_manager, ast::NodeCPtr root + PopManager const& pop_manager, IdeologyManager const& ideology_manager, + GoodDefinitionManager const& good_definition_manager, ModifierManager const& modifier_manager, ast::NodeCPtr root ) { size_t expected_national_foci = 0; bool ret = expect_dictionary_reserve_length( @@ -86,41 +86,46 @@ bool NationalFocusManager::load_national_foci_file( reserve_more_national_foci(expected_national_foci); - ret &= expect_national_focus_group_dictionary([this, &pop_manager, &ideology_manager, &good_manager, &modifier_manager]( - NationalFocusGroup const& group, ast::NodeCPtr group_node - ) -> bool { - return expect_dictionary([this, &group, &pop_manager, &ideology_manager, &good_manager, &modifier_manager]( - std::string_view identifier, ast::NodeCPtr node + ret &= expect_national_focus_group_dictionary( + [this, &pop_manager, &ideology_manager, &good_definition_manager, &modifier_manager]( + NationalFocusGroup const& group, ast::NodeCPtr group_node ) -> bool { - uint8_t icon = 0; - bool has_flashpoint = false, own_provinces = true, outliner_show_as_percent = false; - ModifierValue modifiers; - Ideology const* loyalty_ideology = nullptr; - fixed_point_t loyalty_value = 0; - ConditionScript limit { - scope_t::PROVINCE | scope_t::COUNTRY, scope_t::PROVINCE | scope_t::COUNTRY, scope_t::NO_SCOPE - }; + return expect_dictionary( + [this, &group, &pop_manager, &ideology_manager, &good_definition_manager, &modifier_manager]( + std::string_view identifier, ast::NodeCPtr node + ) -> bool { + uint8_t icon = 0; + bool has_flashpoint = false, own_provinces = true, outliner_show_as_percent = false; + ModifierValue modifiers; + Ideology const* loyalty_ideology = nullptr; + fixed_point_t loyalty_value = 0; + ConditionScript limit { + scope_t::PROVINCE | scope_t::COUNTRY, scope_t::PROVINCE | scope_t::COUNTRY, scope_t::NO_SCOPE + }; - bool ret = modifier_manager.expect_modifier_value_and_keys( - move_variable_callback(modifiers), - "icon", ONE_EXACTLY, expect_uint(assign_variable_callback(icon)), - "ideology", ZERO_OR_ONE, - ideology_manager.expect_ideology_identifier(assign_variable_callback_pointer(loyalty_ideology)), - "loyalty_value", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(loyalty_value)), - "limit", ZERO_OR_ONE, limit.expect_script(), - "has_flashpoint", ZERO_OR_ONE, expect_bool(assign_variable_callback(has_flashpoint)), - "own_provinces", ZERO_OR_ONE, expect_bool(assign_variable_callback(own_provinces)), - "outliner_show_as_percent", ZERO_OR_ONE, expect_bool(assign_variable_callback(outliner_show_as_percent)) - )(node); + bool ret = modifier_manager.expect_modifier_value_and_keys( + move_variable_callback(modifiers), + "icon", ONE_EXACTLY, expect_uint(assign_variable_callback(icon)), + "ideology", ZERO_OR_ONE, + ideology_manager.expect_ideology_identifier(assign_variable_callback_pointer(loyalty_ideology)), + "loyalty_value", ZERO_OR_ONE, expect_fixed_point(assign_variable_callback(loyalty_value)), + "limit", ZERO_OR_ONE, limit.expect_script(), + "has_flashpoint", ZERO_OR_ONE, expect_bool(assign_variable_callback(has_flashpoint)), + "own_provinces", ZERO_OR_ONE, expect_bool(assign_variable_callback(own_provinces)), + "outliner_show_as_percent", ZERO_OR_ONE, + expect_bool(assign_variable_callback(outliner_show_as_percent)) + )(node); - ret &= add_national_focus( - identifier, group, icon, has_flashpoint, own_provinces, outliner_show_as_percent, std::move(modifiers), - loyalty_ideology, loyalty_value, std::move(limit) - ); + ret &= add_national_focus( + identifier, group, icon, has_flashpoint, own_provinces, outliner_show_as_percent, std::move(modifiers), + loyalty_ideology, loyalty_value, std::move(limit) + ); - return ret; - })(group_node); - })(root); + return ret; + } + )(group_node); + } + )(root); lock_national_foci(); return ret; |