diff options
author | hop311 <hop3114@gmail.com> | 2024-10-27 12:56:46 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-10-29 23:55:10 +0100 |
commit | 9a5468ceb4361059fcefae1a383a7c29b4f4e7be (patch) | |
tree | 4ff826fd008548cb79f71df83c422388a24de0da /src/openvic-simulation/politics | |
parent | 309deb6a5b28c8e2b24e73d06f1418bb992b4cd7 (diff) |
Rename `scope_t` enum to `scope_type_t`
Diffstat (limited to 'src/openvic-simulation/politics')
-rw-r--r-- | src/openvic-simulation/politics/Ideology.cpp | 20 | ||||
-rw-r--r-- | src/openvic-simulation/politics/Issue.cpp | 6 | ||||
-rw-r--r-- | src/openvic-simulation/politics/NationalFocus.cpp | 4 | ||||
-rw-r--r-- | src/openvic-simulation/politics/Rebel.cpp | 12 |
4 files changed, 27 insertions, 15 deletions
diff --git a/src/openvic-simulation/politics/Ideology.cpp b/src/openvic-simulation/politics/Ideology.cpp index 546d16e..ca21997 100644 --- a/src/openvic-simulation/politics/Ideology.cpp +++ b/src/openvic-simulation/politics/Ideology.cpp @@ -83,15 +83,17 @@ bool IdeologyManager::load_ideology_file(ast::NodeCPtr root) { IdeologyGroup const* ideology_group = get_ideology_group_by_identifier(ideology_group_key); return expect_dictionary([this, ideology_group](std::string_view key, ast::NodeCPtr value) -> bool { + using enum scope_type_t; + colour_t colour = colour_t::null(); bool uncivilised = true, can_reduce_militancy = false; Date spawn_date; - ConditionalWeight add_political_reform { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight remove_political_reform { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight add_social_reform { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight remove_social_reform { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight add_military_reform { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight add_economic_reform { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; + ConditionalWeight add_political_reform { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionalWeight remove_political_reform { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionalWeight add_social_reform { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionalWeight remove_social_reform { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionalWeight add_military_reform { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionalWeight add_economic_reform { COUNTRY, COUNTRY, NO_SCOPE }; bool ret = expect_dictionary_keys( "uncivilized", ZERO_OR_ONE, expect_bool(assign_variable_callback(uncivilised)), @@ -99,20 +101,24 @@ bool IdeologyManager::load_ideology_file(ast::NodeCPtr root) { "date", ZERO_OR_ONE, expect_date(assign_variable_callback(spawn_date)), "can_reduce_militancy", ZERO_OR_ONE, expect_bool(assign_variable_callback(can_reduce_militancy)), "add_political_reform", ONE_EXACTLY, add_political_reform.expect_conditional_weight(ConditionalWeight::BASE), - "remove_political_reform", ONE_EXACTLY, remove_political_reform.expect_conditional_weight(ConditionalWeight::BASE), + "remove_political_reform", ONE_EXACTLY, + remove_political_reform.expect_conditional_weight(ConditionalWeight::BASE), "add_social_reform", ONE_EXACTLY, add_social_reform.expect_conditional_weight(ConditionalWeight::BASE), "remove_social_reform", ONE_EXACTLY, remove_social_reform.expect_conditional_weight(ConditionalWeight::BASE), "add_military_reform", ZERO_OR_ONE, add_military_reform.expect_conditional_weight(ConditionalWeight::BASE), "add_economic_reform", ZERO_OR_ONE, add_economic_reform.expect_conditional_weight(ConditionalWeight::BASE) )(value); + ret &= add_ideology( key, colour, ideology_group, uncivilised, can_reduce_militancy, spawn_date, std::move(add_political_reform), std::move(remove_political_reform), std::move(add_social_reform), std::move(remove_social_reform), std::move(add_military_reform), std::move(add_economic_reform) ); + return ret; })(ideology_group_value); })(root); + lock_ideologies(); return ret; diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp index 8da09fc..71356b6 100644 --- a/src/openvic-simulation/politics/Issue.cpp +++ b/src/openvic-simulation/politics/Issue.cpp @@ -221,12 +221,14 @@ bool IssueManager::_load_reform( ModifierManager const& modifier_manager, RuleManager const& rule_manager, size_t ordinal, std::string_view identifier, ReformGroup const* group, ast::NodeCPtr node ) { + using enum scope_type_t; + ModifierValue values; RuleSet rules; fixed_point_t administrative_multiplier = 0; Reform::tech_cost_t technology_cost = 0; - ConditionScript allow { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionScript on_execute_trigger { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; + ConditionScript allow { COUNTRY, COUNTRY, NO_SCOPE }; + ConditionScript on_execute_trigger { COUNTRY, COUNTRY, NO_SCOPE }; EffectScript on_execute_effect; bool ret = NodeTools::expect_dictionary_keys_and_default( diff --git a/src/openvic-simulation/politics/NationalFocus.cpp b/src/openvic-simulation/politics/NationalFocus.cpp index 2427d7c..b60b3f5 100644 --- a/src/openvic-simulation/politics/NationalFocus.cpp +++ b/src/openvic-simulation/politics/NationalFocus.cpp @@ -117,6 +117,8 @@ bool NationalFocusManager::load_national_foci_file( [this, &group, &pop_manager, &ideology_manager, &good_definition_manager, &modifier_manager]( std::string_view identifier, ast::NodeCPtr node ) -> bool { + using enum scope_type_t; + uint8_t icon = 0; bool has_flashpoint = false, own_provinces = true, outliner_show_as_percent = false; fixed_point_t flashpoint_tension = 0; @@ -127,7 +129,7 @@ bool NationalFocusManager::load_national_foci_file( fixed_point_map_t<GoodDefinition const*> encourage_goods; fixed_point_map_t<PopType const*> encourage_pop_types; ConditionScript limit { - scope_t::PROVINCE | scope_t::COUNTRY, scope_t::PROVINCE | scope_t::COUNTRY, scope_t::NO_SCOPE + PROVINCE | COUNTRY, PROVINCE | COUNTRY, NO_SCOPE }; const auto expect_base_province_modifier_cb = modifier_manager.expect_base_province_modifier(modifiers); diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp index 9b2927c..ccaee5e 100644 --- a/src/openvic-simulation/politics/Rebel.cpp +++ b/src/openvic-simulation/politics/Rebel.cpp @@ -98,6 +98,8 @@ bool RebelManager::load_rebels_file( bool ret = expect_dictionary_reserve_length( rebel_types, [this, &ideology_manager, &government_type_manager](std::string_view identifier, ast::NodeCPtr node) -> bool { + using enum scope_type_t; + RebelType::icon_t icon = 0; RebelType::area_t area = RebelType::area_t::ALL; RebelType::government_map_t desired_governments; @@ -109,11 +111,11 @@ bool RebelManager::load_rebels_file( allow_all_religions = true, allow_all_ideologies = true, resilient = true, reinforcing = true, general = true, smart = true, unit_transfer = false; fixed_point_t occupation_mult = 0; - ConditionalWeight will_rise { scope_t::POP, scope_t::COUNTRY, scope_t::NO_SCOPE }; - ConditionalWeight spawn_chance { scope_t::POP, scope_t::POP, scope_t::NO_SCOPE }; - ConditionalWeight movement_evaluation { scope_t::PROVINCE, scope_t::PROVINCE, scope_t::NO_SCOPE }; - ConditionScript siege_won_trigger { scope_t::PROVINCE, scope_t::PROVINCE, scope_t::NO_SCOPE }; - ConditionScript demands_enforced_trigger { scope_t::COUNTRY, scope_t::COUNTRY, scope_t::NO_SCOPE }; + ConditionalWeight will_rise { POP, COUNTRY, NO_SCOPE }; + ConditionalWeight spawn_chance { POP, POP, NO_SCOPE }; + ConditionalWeight movement_evaluation { PROVINCE, PROVINCE, NO_SCOPE }; + ConditionScript siege_won_trigger { PROVINCE, PROVINCE, NO_SCOPE }; + ConditionScript demands_enforced_trigger { COUNTRY, COUNTRY, NO_SCOPE }; EffectScript siege_won_effect, demands_enforced_effect; bool ret = expect_dictionary_keys( |