@@ -61,51 +61,51 @@ static constexpr size_t DAYS_OF_BALANCE_HISTORY = 30;
6161static constexpr colour_t ERROR_COLOUR = colour_t ::from_integer(0xFF0000 );
6262
6363CountryInstance::CountryInstance (
64- CountryDefinition const * new_country_definition,
65- SharedCountryValues* new_shared_country_values,
66- CountryInstanceDeps const * country_instance_deps
64+ CountryDefinition const & new_country_definition,
65+ SharedCountryValues& new_shared_country_values,
66+ CountryInstanceDeps const & country_instance_deps
6767) : FlagStrings { " country" },
68- HasIndex { new_country_definition-> index },
68+ HasIndex { new_country_definition. index },
6969 PopsAggregate {
70- country_instance_deps-> stratas ,
71- country_instance_deps-> pop_types ,
72- country_instance_deps-> ideologies
70+ country_instance_deps. stratas ,
71+ country_instance_deps. pop_types ,
72+ country_instance_deps. ideologies
7373 },
7474 /* Main attributes */
75- country_definition { * new_country_definition },
76- shared_country_values { * new_shared_country_values },
77-
78- country_relations_manager { country_instance_deps-> country_relations_manager },
79- game_rules_manager { country_instance_deps-> game_rules_manager },
80- good_instance_manager { country_instance_deps-> good_instance_manager },
81- market_instance { country_instance_deps-> market_instance },
82- modifier_effect_cache { country_instance_deps-> modifier_effect_cache },
83- unit_type_manager { country_instance_deps-> unit_type_manager },
75+ country_definition { new_country_definition },
76+ shared_country_values { new_shared_country_values },
77+
78+ country_relations_manager { country_instance_deps. country_relations_manager },
79+ game_rules_manager { country_instance_deps. game_rules_manager },
80+ good_instance_manager { country_instance_deps. good_instance_manager },
81+ market_instance { country_instance_deps. market_instance },
82+ modifier_effect_cache { country_instance_deps. modifier_effect_cache },
83+ unit_type_manager { country_instance_deps. unit_type_manager },
8484
85- fallback_date_for_never_completing_research { country_instance_deps-> fallback_date_for_never_completing_research },
86- country_defines { country_instance_deps-> country_defines },
87- diplomacy_defines { country_instance_deps-> diplomacy_defines },
88- economy_defines { country_instance_deps-> economy_defines },
89- military_defines { country_instance_deps-> military_defines },
85+ fallback_date_for_never_completing_research { country_instance_deps. fallback_date_for_never_completing_research },
86+ country_defines { country_instance_deps. country_defines },
87+ diplomacy_defines { country_instance_deps. diplomacy_defines },
88+ economy_defines { country_instance_deps. economy_defines },
89+ military_defines { country_instance_deps. military_defines },
9090
9191 colour { ERROR_COLOUR },
9292
9393 /* Production */
94- building_type_unlock_levels { country_instance_deps-> building_types },
94+ building_type_unlock_levels { country_instance_deps. building_types },
9595
9696 /* Budget */
9797 balance_history{DAYS_OF_BALANCE_HISTORY},
98- taxable_income_by_pop_type { country_instance_deps-> pop_types },
98+ taxable_income_by_pop_type { country_instance_deps. pop_types },
9999 effective_tax_rate_by_strata {
100- country_instance_deps-> stratas ,
100+ country_instance_deps. stratas ,
101101 [this ](Strata const & strata)->auto {
102102 return [this ,&strata](DependencyTracker& tracker)->fixed_point_t {
103103 return tax_efficiency.get (tracker) * tax_rate_slider_value_by_strata.at (strata).get_value (tracker);
104104 };
105105 }
106106 },
107107 administration_salary_base_by_pop_type{
108- country_instance_deps-> pop_types ,
108+ country_instance_deps. pop_types ,
109109 [this ](PopType const & pop_type)->auto {
110110 return [this ,&pop_type](DependencyTracker& tracker)->fixed_point_t {
111111 return corruption_cost_multiplier.get (tracker)
@@ -115,7 +115,7 @@ CountryInstance::CountryInstance(
115115 }
116116 },
117117 education_salary_base_by_pop_type{
118- country_instance_deps-> pop_types ,
118+ country_instance_deps. pop_types ,
119119 [this ](PopType const & pop_type)->auto {
120120 return [this ,&pop_type](DependencyTracker& tracker)->fixed_point_t {
121121 return corruption_cost_multiplier.get (tracker)
@@ -125,7 +125,7 @@ CountryInstance::CountryInstance(
125125 }
126126 },
127127 military_salary_base_by_pop_type{
128- country_instance_deps-> pop_types ,
128+ country_instance_deps. pop_types ,
129129 [this ](PopType const & pop_type)->auto {
130130 return [this ,&pop_type](DependencyTracker& tracker)->fixed_point_t {
131131 return corruption_cost_multiplier.get (tracker)
@@ -135,7 +135,7 @@ CountryInstance::CountryInstance(
135135 }
136136 },
137137 social_income_variant_base_by_pop_type{
138- country_instance_deps-> pop_types ,
138+ country_instance_deps. pop_types ,
139139 [this ](PopType const & pop_type)->auto {
140140 return [this ,&pop_type](DependencyTracker& tracker)->fixed_point_t {
141141 return corruption_cost_multiplier.get (tracker)
@@ -144,26 +144,26 @@ CountryInstance::CountryInstance(
144144 };
145145 }
146146 },
147- tax_rate_slider_value_by_strata { country_instance_deps-> stratas },
147+ tax_rate_slider_value_by_strata { country_instance_deps. stratas },
148148
149149 /* Technology */
150- technology_unlock_levels { country_instance_deps-> technologies },
151- invention_unlock_levels { country_instance_deps-> inventions },
150+ technology_unlock_levels { country_instance_deps. technologies },
151+ invention_unlock_levels { country_instance_deps. inventions },
152152
153153 /* Politics */
154- upper_house_proportion_by_ideology { country_instance_deps-> ideologies },
155- reforms { country_instance_deps-> reforms },
156- flag_overrides_by_government_type { country_instance_deps-> government_types },
157- crime_unlock_levels { country_instance_deps-> crimes },
154+ upper_house_proportion_by_ideology { country_instance_deps. ideologies },
155+ reforms { country_instance_deps. reforms },
156+ flag_overrides_by_government_type { country_instance_deps. government_types },
157+ crime_unlock_levels { country_instance_deps. crimes },
158158
159159 /* Trade */
160- goods_data { country_instance_deps-> good_instances },
160+ goods_data { country_instance_deps. good_instances },
161161
162162 /* Diplomacy */
163163
164164 /* Military */
165- regiment_type_unlock_levels { country_instance_deps-> regiment_types },
166- ship_type_unlock_levels { country_instance_deps-> ship_types },
165+ regiment_type_unlock_levels { country_instance_deps. regiment_types },
166+ ship_type_unlock_levels { country_instance_deps. ship_types },
167167
168168 /* DerivedState */
169169 flag_government_type { [this ](DependencyTracker& tracker)->GovernmentType const * {
@@ -247,7 +247,7 @@ CountryInstance::CountryInstance(
247247 }
248248
249249 // army, navy and construction spending have minimums defined in EconomyDefines and always have an unmodified max (1.0).
250- EconomyDefines const & economy_defines = country_instance_deps-> economy_defines ;
250+ EconomyDefines const & economy_defines = country_instance_deps. economy_defines ;
251251 army_spending_slider_value.set_bounds (economy_defines.get_minimum_army_spending_slider_value (), 1 );
252252 army_spending_slider_value.set_value (1 );
253253
@@ -274,7 +274,7 @@ CountryInstance::CountryInstance(
274274 tariff_rate_slider_value.set_bounds (0 , 0 );
275275 tariff_rate_slider_value.set_value (0 );
276276
277- update_parties_for_votes (new_country_definition);
277+ update_parties_for_votes (& new_country_definition);
278278
279279 for (BuildingType const & building_type : building_type_unlock_levels.get_keys ()) {
280280 if (building_type.is_enabled_by_default ) {
@@ -393,17 +393,17 @@ void CountryInstance::set_alliance_with(CountryInstance& country, bool alliance)
393393}
394394
395395bool CountryInstance::is_at_war_with (CountryInstance const & country) const {
396- return war_enemies.contains (& country);
396+ return war_enemies.contains (country);
397397}
398398
399399void CountryInstance::set_at_war_with (CountryInstance& country, bool at_war) {
400400 country_relations_manager.set_at_war_with (this , &country, at_war);
401401 if (at_war) {
402- war_enemies.insert (& country);
403- country.war_enemies .insert ( this );
402+ war_enemies.emplace ( country);
403+ country.war_enemies .emplace (* this );
404404 } else {
405- war_enemies.unordered_erase (& country);
406- country.war_enemies .unordered_erase (this );
405+ war_enemies.unordered_erase (country);
406+ country.war_enemies .unordered_erase (* this );
407407 }
408408}
409409
@@ -639,7 +639,7 @@ bool CountryInstance::set_ruling_party(CountryParty const& new_ruling_party) {
639639}
640640
641641bool CountryInstance::add_reform (Reform const & new_reform) {
642- ReformGroup const & reform_group = new_reform.get_reform_group () ;
642+ ReformGroup const & reform_group = new_reform.group ;
643643 Reform const *& reform = reforms.at (reform_group);
644644
645645 if (reform != &new_reform) {
@@ -1211,7 +1211,7 @@ bool CountryInstance::can_research_tech(Technology const& technology, const Date
12111211
12121212 const Technology::area_index_t index_in_area = technology.index_in_area ;
12131213
1214- return index_in_area == 0 || is_technology_unlocked (* technology.area .get_technologies ()[index_in_area - 1 ]);
1214+ return index_in_area == 0 || is_technology_unlocked (technology.area .get_technologies ()[index_in_area - 1 ]);
12151215}
12161216
12171217void CountryInstance::start_research (Technology const & technology, const Date today) {
@@ -1233,7 +1233,7 @@ void CountryInstance::apply_foreign_investments(
12331233 fixed_point_map_t <CountryDefinition const *> const & investments, CountryInstanceManager const & country_instance_manager
12341234) {
12351235 for (auto const & [country, money_invested] : investments) {
1236- foreign_investments[& country_instance_manager.get_country_instance_by_definition (*country)] = money_invested;
1236+ foreign_investments[country_instance_manager.get_country_instance_by_definition (*country)] = money_invested;
12371237 }
12381238}
12391239
@@ -1320,16 +1320,17 @@ void CountryInstance::_update_production() {
13201320 industrial_power_from_states.clear ();
13211321 industrial_power_from_investments.clear ();
13221322
1323- for (State const * state : states) {
1324- const fixed_point_t state_industrial_power = state->get_industrial_power ();
1323+ for (State const * state_ptr : states) {
1324+ State const & state = *state_ptr;
1325+ const fixed_point_t state_industrial_power = state.get_industrial_power ();
13251326 if (state_industrial_power != 0 ) {
13261327 industrial_power += state_industrial_power;
13271328 industrial_power_from_states.emplace_back (state, state_industrial_power);
13281329 }
13291330 }
13301331
13311332 for (auto const & [country, money_invested] : foreign_investments) {
1332- if (country-> exists ()) {
1333+ if (country. get (). exists ()) {
13331334 const fixed_point_t investment_industrial_power = fixed_point_t::mul_div (
13341335 money_invested,
13351336 country_defines.get_country_investment_industrial_score_factor (),
0 commit comments