@@ -7,20 +7,22 @@ NationalFocusGroup::NationalFocusGroup(std::string_view new_identifier) : HasIde
77
88NationalFocus::NationalFocus (
99 std::string_view new_identifier,
10- uint8_t new_icon,
1110 NationalFocusGroup const & new_group,
11+ uint8_t new_icon,
12+ bool new_has_flashpoint,
13+ bool new_own_provinces,
14+ bool new_outliner_show_as_percent,
1215 ModifierValue&& new_modifiers,
13- pop_promotion_map_t && new_encouraged_promotion,
14- production_map_t && new_encouraged_production,
1516 Ideology const * new_loyalty_ideology,
1617 fixed_point_t new_loyalty_value,
1718 ConditionScript&& new_limit
1819) : HasIdentifier { new_identifier },
19- icon { new_icon },
2020 group { new_group },
21+ icon { new_icon },
22+ has_flashpoint { new_has_flashpoint },
23+ own_provinces { new_own_provinces },
24+ outliner_show_as_percent { new_outliner_show_as_percent },
2125 modifiers { std::move (new_modifiers) },
22- encouraged_promotion { std::move (new_encouraged_promotion) },
23- encouraged_production { std::move (new_encouraged_production) },
2426 loyalty_ideology { new_loyalty_ideology },
2527 loyalty_value { new_loyalty_value },
2628 limit { std::move (new_limit) } {}
@@ -39,11 +41,12 @@ inline bool NationalFocusManager::add_national_focus_group(std::string_view iden
3941
4042inline bool NationalFocusManager::add_national_focus (
4143 std::string_view identifier,
42- uint8_t icon,
4344 NationalFocusGroup const & group,
45+ uint8_t icon,
46+ bool has_flashpoint,
47+ bool own_provinces,
48+ bool outliner_show_as_percent,
4449 ModifierValue&& modifiers,
45- NationalFocus::pop_promotion_map_t && encouraged_promotion,
46- NationalFocus::production_map_t && encouraged_production,
4750 Ideology const * loyalty_ideology,
4851 fixed_point_t loyalty_value,
4952 ConditionScript&& limit
@@ -63,7 +66,7 @@ inline bool NationalFocusManager::add_national_focus(
6366 );
6467 }
6568 return national_foci.add_item ({
66- identifier, icon, group, std::move (modifiers), std::move (encouraged_promotion) , std::move (encouraged_production ),
69+ identifier, group, icon, has_flashpoint, own_provinces, outliner_show_as_percent , std::move (modifiers ),
6770 loyalty_ideology, loyalty_value, std::move (limit)
6871 });
6972}
@@ -90,40 +93,28 @@ bool NationalFocusManager::load_national_foci_file(
9093 std::string_view identifier, ast::NodeCPtr node
9194 ) -> bool {
9295 uint8_t icon = 0 ;
96+ bool has_flashpoint = false , own_provinces = true , outliner_show_as_percent = false ;
9397 ModifierValue modifiers;
94- NationalFocus::pop_promotion_map_t promotions;
95- NationalFocus::production_map_t production;
9698 Ideology const * loyalty_ideology = nullptr ;
9799 fixed_point_t loyalty_value = 0 ;
98- ConditionScript limit { scope_t ::PROVINCE | scope_t ::COUNTRY, scope_t ::PROVINCE | scope_t ::COUNTRY, scope_t ::NO_SCOPE };
100+ ConditionScript limit {
101+ scope_t ::PROVINCE | scope_t ::COUNTRY, scope_t ::PROVINCE | scope_t ::COUNTRY, scope_t ::NO_SCOPE
102+ };
99103
100- bool ret = modifier_manager.expect_modifier_value_and_keys_and_default (
104+ bool ret = modifier_manager.expect_modifier_value_and_keys (
101105 move_variable_callback (modifiers),
102- [&promotions, &pop_manager, &production, &good_manager, &modifiers, &modifier_manager](
103- std::string_view key, ast::NodeCPtr value
104- ) -> bool {
105- PopType const * pop_type = pop_manager.get_pop_type_by_identifier (key);
106- if (pop_type != nullptr ) {
107- return expect_fixed_point (map_callback (promotions, pop_type))(value);
108- }
109- Good const * good = good_manager.get_good_by_identifier (key);
110- if (good != nullptr ) {
111- return expect_fixed_point (map_callback (production, good))(value);
112- }
113- return key_value_invalid_callback (key, value);
114- },
115106 " icon" , ONE_EXACTLY, expect_uint (assign_variable_callback (icon)),
116107 " ideology" , ZERO_OR_ONE,
117108 ideology_manager.expect_ideology_identifier (assign_variable_callback_pointer (loyalty_ideology)),
118109 " loyalty_value" , ZERO_OR_ONE, expect_fixed_point (assign_variable_callback (loyalty_value)),
119110 " limit" , ZERO_OR_ONE, limit.expect_script (),
120- " has_flashpoint" , ZERO_OR_ONE, success_callback, // special case, include in limit
121- " own_provinces" , ZERO_OR_ONE, success_callback, // special case, include in limit
122- " outliner_show_as_percent" , ZERO_OR_ONE, success_callback // special case
111+ " has_flashpoint" , ZERO_OR_ONE, expect_bool ( assign_variable_callback (has_flashpoint)),
112+ " own_provinces" , ZERO_OR_ONE, expect_bool ( assign_variable_callback (own_provinces)),
113+ " outliner_show_as_percent" , ZERO_OR_ONE, expect_bool ( assign_variable_callback (outliner_show_as_percent))
123114 )(node);
124115
125116 ret &= add_national_focus (
126- identifier, icon, group, std::move (modifiers), std::move (promotions) , std::move (production ),
117+ identifier, group, icon, has_flashpoint, own_provinces, outliner_show_as_percent , std::move (modifiers ),
127118 loyalty_ideology, loyalty_value, std::move (limit)
128119 );
129120
0 commit comments