@@ -153,12 +153,14 @@ String MenuSingleton::_make_rules_tooltip(RuleSet const& rules) const {
153153}
154154
155155String MenuSingleton::_make_mobilisation_impact_tooltip () const {
156- CountryInstance const * country = PlayerSingleton::get_singleton ()->get_player_country ();
156+ CountryInstance const * country_ptr = PlayerSingleton::get_singleton ()->get_player_country ();
157157
158- if (country == nullptr ) {
158+ if (country_ptr == nullptr ) {
159159 return {};
160160 }
161161
162+ CountryInstance const & country = *country_ptr;
163+
162164 IssueManager const & issue_manager =
163165 GameSingleton::get_singleton ()->get_definition_manager ().get_politics_manager ().get_issue_manager ();
164166
@@ -176,9 +178,9 @@ String MenuSingleton::_make_mobilisation_impact_tooltip() const {
176178 PartyPolicyGroup const * war_policy_issue_group = issue_manager.get_party_policy_group_by_identifier (" war_policy" );
177179 PartyPolicy const * war_policy_issue = war_policy_issue_group == nullptr
178180 ? nullptr
179- : country-> get_ruling_party_untracked ()->get_policies (*war_policy_issue_group);
181+ : country. get_ruling_party_untracked ()->get_policies (*war_policy_issue_group);
180182
181- const String impact_string = Utilities::fixed_point_to_string_dp (country-> get_mobilisation_impact () * 100 , 1 ) + " %" ;
183+ const String impact_string = Utilities::fixed_point_to_string_dp (country. get_mobilisation_impact () * 100 , 1 ) + " %" ;
182184
183185 return tr (
184186 mobilisation_impact_tooltip_localisation_key
@@ -192,11 +194,11 @@ String MenuSingleton::_make_mobilisation_impact_tooltip() const {
192194 )
193195 ).replace (
194196 mobilisation_impact_tooltip_replace_units_key,
195- String::num_uint64 (country-> get_mobilisation_max_regiment_count ())
197+ String::num_uint64 (country. get_mobilisation_max_regiment_count ())
196198 ) + " \n " + tr (
197199 mobilisation_impact_tooltip2_localisation_key
198200 ).replace (
199- mobilisation_impact_tooltip2_replace_curr_key, String::num_uint64 (country-> get_regiment_count ())
201+ mobilisation_impact_tooltip2_replace_curr_key, String::num_uint64 (country. get_regiment_count ())
200202 ).replace (
201203 mobilisation_impact_tooltip2_replace_impact_key, impact_string
202204 );
@@ -996,11 +998,13 @@ int32_t MenuSingleton::get_rgo_owner_pop_icon_index() const {
996998/* TOPBAR */
997999
9981000Dictionary MenuSingleton::get_topbar_info () const {
999- CountryInstance* country = PlayerSingleton::get_singleton ()->get_player_country ();
1000- if (country == nullptr ) {
1001+ CountryInstance* country_ptr = PlayerSingleton::get_singleton ()->get_player_country ();
1002+ if (country_ptr == nullptr ) {
10011003 return {};
10021004 }
10031005
1006+ CountryInstance& country = *country_ptr;
1007+
10041008 DefinitionManager const & definition_manager = GameSingleton::get_singleton ()->get_definition_manager ();
10051009 ModifierEffectCache const & modifier_effect_cache = definition_manager.get_modifier_manager ().get_modifier_effect_cache ();
10061010
@@ -1011,9 +1015,9 @@ Dictionary MenuSingleton::get_topbar_info() const {
10111015 static const StringName country_status_key = " country_status" ;
10121016 static const StringName total_rank_key = " total_rank" ;
10131017
1014- ret[country_key] = convert_to<String>(country-> get_identifier ());
1015- ret[country_status_key] = static_cast <int32_t >(country-> get_country_status ());
1016- ret[total_rank_key] = static_cast <uint64_t >(country-> get_total_rank ());
1018+ ret[country_key] = convert_to<String>(country. get_identifier ());
1019+ ret[country_status_key] = static_cast <int32_t >(country. get_country_status ());
1020+ ret[total_rank_key] = static_cast <uint64_t >(country. get_total_rank ());
10171021
10181022 // Production
10191023
@@ -1029,7 +1033,7 @@ Dictionary MenuSingleton::get_topbar_info() const {
10291033 static const StringName research_points_key = " research_points" ;
10301034 static const StringName research_points_tooltip_key = " research_points_tooltip" ;
10311035
1032- Technology const * current_research = country-> get_current_research_untracked ();
1036+ Technology const * current_research = country. get_current_research_untracked ();
10331037 if (current_research != nullptr ) {
10341038 static const StringName research_localisation_key = " TECHNOLOGYVIEW_RESEARCH_TOOLTIP" ;
10351039 static const String tech_replace_key = " $TECH$" ;
@@ -1043,15 +1047,15 @@ Dictionary MenuSingleton::get_topbar_info() const {
10431047 ret[research_tooltip_key] = tr (research_localisation_key).replace (
10441048 tech_replace_key, current_tech_localised
10451049 ).replace (
1046- date_replace_key, Utilities::date_to_formatted_string (country-> get_expected_research_completion_date_untracked (), false )
1050+ date_replace_key, Utilities::date_to_formatted_string (country. get_expected_research_completion_date_untracked (), false )
10471051 ) + " \n " + tr (research_invested_localisation_key).replace (
1048- invested_replace_key, String::num_uint64 (country-> get_invested_research_points_untracked ().truncate <int64_t >())
1049- ).replace (cost_replace_key, String::num_uint64 (country-> get_current_research_cost_untracked ().truncate <int64_t >()));
1052+ invested_replace_key, String::num_uint64 (country. get_invested_research_points_untracked ().truncate <int64_t >())
1053+ ).replace (cost_replace_key, String::num_uint64 (country. get_current_research_cost_untracked ().truncate <int64_t >()));
10501054
10511055 ret[research_key] = std::move (current_tech_localised);
10521056
1053- ret[research_progress_key] = static_cast <real_t >(country-> research_progress .get_untracked ());
1054- } else if (country-> is_civilised ()) {
1057+ ret[research_progress_key] = static_cast <real_t >(country. research_progress .get_untracked ());
1058+ } else if (country. is_civilised ()) {
10551059 static const StringName civilised_no_research_localisation_key = " TB_TECH_NO_CURRENT" ;
10561060 static const StringName civilised_no_research_tooltip_localisation_key = " TECHNOLOGYVIEW_NO_RESEARCH_TOOLTIP" ;
10571061
@@ -1067,17 +1071,17 @@ Dictionary MenuSingleton::get_topbar_info() const {
10671071 ret[research_tooltip_key] = tr (uncivilised_no_research_tooltip_localisation_key);
10681072 }
10691073
1070- ret[literacy_key] = static_cast <real_t >(country-> get_average_literacy ());
1074+ ret[literacy_key] = static_cast <real_t >(country. get_average_literacy ());
10711075 // TODO - set monthly literacy change (test for precision issues)
10721076 ret[literacy_change_key] = 0 .0f ;
10731077
1074- ret[research_points_key] = static_cast <real_t >(country-> get_daily_research_points_untracked ());
1078+ ret[research_points_key] = static_cast <real_t >(country. get_daily_research_points_untracked ());
10751079
10761080 String research_points_tooltip;
10771081
10781082 fixed_point_t daily_base_research_points;
10791083
1080- for (auto const & [pop_type, research_points] : country-> get_research_points_from_pop_types ()) {
1084+ for (auto const & [pop_type, research_points] : country. get_research_points_from_pop_types ()) {
10811085 static const StringName pop_type_research_localisation_key = " TECH_DAILY_RESEARCHPOINTS_TOOLTIP" ;
10821086 static const String pop_type_replace_key = " $POPTYPE$" ;
10831087 static const String fraction_replace_key = " $FRACTION$" ;
@@ -1093,8 +1097,8 @@ Dictionary MenuSingleton::get_topbar_info() const {
10931097 ).replace (
10941098 fraction_replace_key, Utilities::fixed_point_to_string_dp (
10951099 fixed_point_t::from_fraction (
1096- 100 * country-> get_population_by_type (*pop_type),
1097- country-> get_total_population ()
1100+ 100 * country. get_population_by_type (*pop_type),
1101+ country. get_total_population ()
10981102 ), 2
10991103 )
11001104 ).replace (
@@ -1105,7 +1109,7 @@ Dictionary MenuSingleton::get_topbar_info() const {
11051109 // Empty prefix, "\n" suffix, fitting with the potential trailing "\n" from the pop type contributions and the upcoming
11061110 // guaranteed daily base research points line. All contributions are added to daily_base_research_points.
11071111 research_points_tooltip += _make_modifier_effect_contributions_tooltip (
1108- * country, *modifier_effect_cache.get_research_points (), &daily_base_research_points, {}, " \n "
1112+ country, *modifier_effect_cache.get_research_points (), &daily_base_research_points, {}, " \n "
11091113 );
11101114
11111115 // The daily base research points line is guaranteed to be present, but those directly above and below it aren't,
@@ -1118,11 +1122,12 @@ Dictionary MenuSingleton::get_topbar_info() const {
11181122 );
11191123
11201124 research_points_tooltip += _make_modifier_effect_contributions_tooltip (
1121- * country, *modifier_effect_cache.get_research_points_modifier ()
1125+ country, *modifier_effect_cache.get_research_points_modifier ()
11221126 );
11231127
1124- const fixed_point_t research_points_modifier_from_tech =
1125- country->get_modifier_effect_value (*modifier_effect_cache.get_increase_research ());
1128+ const fixed_point_t research_points_modifier_from_tech = country.get_modifier_effect_value (
1129+ *modifier_effect_cache.get_increase_research ()
1130+ );
11261131 if (research_points_modifier_from_tech != fixed_point_t ::_0) {
11271132 static const StringName from_technology_localisation_key = " FROM_TECHNOLOGY" ;
11281133 research_points_tooltip += " \n " + tr (from_technology_localisation_key) + " : " +
@@ -1134,7 +1139,7 @@ Dictionary MenuSingleton::get_topbar_info() const {
11341139 static const StringName daily_research_points_localisation_key = " TECH_DAILY_RESEARCHPOINTS_TOTAL_TOOLTIP" ;
11351140 research_points_tooltip += " \n " + tr (daily_research_points_localisation_key).replace (
11361141 Utilities::get_long_value_placeholder (),
1137- Utilities::fixed_point_to_string_dp (country-> get_daily_research_points_untracked (), 2 )
1142+ Utilities::fixed_point_to_string_dp (country. get_daily_research_points_untracked (), 2 )
11381143 );
11391144
11401145 // In the base game this section is only shown when no research is set, but it's useful to show it always
@@ -1143,7 +1148,7 @@ Dictionary MenuSingleton::get_topbar_info() const {
11431148 static const StringName accumulated_research_points_localisation_key = " RP_ACCUMULATED" ;
11441149 research_points_tooltip += tr (accumulated_research_points_localisation_key).replace (
11451150 Utilities::get_short_value_placeholder (),
1146- Utilities::fixed_point_to_string_dp (country-> get_research_point_stockpile_untracked (), 1 )
1151+ Utilities::fixed_point_to_string_dp (country. get_research_point_stockpile_untracked (), 1 )
11471152 );
11481153
11491154 ret[research_points_tooltip_key] = std::move (research_points_tooltip);
@@ -1161,31 +1166,31 @@ Dictionary MenuSingleton::get_topbar_info() const {
11611166 static const StringName regiment_count_key = " regiment_count" ;
11621167 static const StringName max_supported_regiments_key = " max_supported_regiments" ;
11631168
1164- ret[regiment_count_key] = static_cast <uint64_t >(country-> get_regiment_count ());
1165- ret[max_supported_regiments_key] = static_cast <uint64_t >(country-> get_max_supported_regiment_count ());
1169+ ret[regiment_count_key] = static_cast <uint64_t >(country. get_regiment_count ());
1170+ ret[max_supported_regiments_key] = static_cast <uint64_t >(country. get_max_supported_regiment_count ());
11661171
11671172 static const StringName is_mobilised_key = " is_mobilised" ;
11681173 static const StringName mobilisation_regiments_key = " mobilisation_regiments" ;
11691174 static const StringName mobilisation_impact_tooltip_key = " mobilisation_impact_tooltip" ;
11701175
1171- if (country-> is_mobilised ()) {
1176+ if (country. is_mobilised ()) {
11721177 ret[is_mobilised_key] = true ;
11731178 } else {
1174- ret[mobilisation_regiments_key] = static_cast <uint64_t >(country-> get_mobilisation_potential_regiment_count ());
1179+ ret[mobilisation_regiments_key] = static_cast <uint64_t >(country. get_mobilisation_potential_regiment_count ());
11751180 ret[mobilisation_impact_tooltip_key] = _make_mobilisation_impact_tooltip ();
11761181 }
11771182
11781183 {
11791184 static const StringName leadership_key = " leadership" ;
11801185 static const StringName leadership_tooltip_key = " leadership_tooltip" ;
11811186
1182- ret[leadership_key] = country-> get_leadership_point_stockpile ().truncate <int64_t >();
1187+ ret[leadership_key] = country. get_leadership_point_stockpile ().truncate <int64_t >();
11831188
11841189 String leadership_tooltip;
11851190
11861191 fixed_point_t monthly_base_leadership_points;
11871192
1188- for (auto const & [pop_type, leadership_points] : country-> get_leadership_points_from_pop_types ()) {
1193+ for (auto const & [pop_type, leadership_points] : country. get_leadership_points_from_pop_types ()) {
11891194 static const StringName pop_type_leadership_localisation_key = " TECH_DAILY_LEADERSHIP_TOOLTIP" ;
11901195 static const String pop_type_replace_key = " $POPTYPE$" ;
11911196 static const String fraction_replace_key = " $FRACTION$" ;
@@ -1201,8 +1206,8 @@ Dictionary MenuSingleton::get_topbar_info() const {
12011206 ).replace (
12021207 fraction_replace_key, Utilities::fixed_point_to_string_dp (
12031208 fixed_point_t::from_fraction (
1204- 100 * country-> get_population_by_type (*pop_type),
1205- country-> get_total_population ()
1209+ 100 * country. get_population_by_type (*pop_type),
1210+ country. get_total_population ()
12061211 ), 2
12071212 )
12081213 ).replace (
@@ -1213,7 +1218,7 @@ Dictionary MenuSingleton::get_topbar_info() const {
12131218 // Empty prefix, "\n" suffix, fitting with the potential trailing "\n" from the pop type contributions and the upcoming
12141219 // guaranteed monthly base leadership points line. All contributions are added to monthly_base_leadership_points.
12151220 leadership_tooltip += _make_modifier_effect_contributions_tooltip (
1216- * country, *modifier_effect_cache.get_leadership (), &monthly_base_leadership_points, {}, " \n "
1221+ country, *modifier_effect_cache.get_leadership (), &monthly_base_leadership_points, {}, " \n "
12171222 );
12181223
12191224 // The monthly base leadership points line is guaranteed to be present, but those directly above and below it aren't,
@@ -1226,18 +1231,18 @@ Dictionary MenuSingleton::get_topbar_info() const {
12261231 );
12271232
12281233 leadership_tooltip += _make_modifier_effect_contributions_tooltip (
1229- * country, *modifier_effect_cache.get_leadership_modifier ()
1234+ country, *modifier_effect_cache.get_leadership_modifier ()
12301235 );
12311236
12321237 static const StringName monthly_leadership_points_localisation_key = " TECH_DAILY_LEADERSHIP_TOTAL_TOOLTIP" ;
12331238 leadership_tooltip += " \n " + tr (monthly_leadership_points_localisation_key).replace (
12341239 Utilities::get_long_value_placeholder (),
1235- Utilities::fixed_point_to_string_dp (country-> get_monthly_leadership_points (), 2 )
1240+ Utilities::fixed_point_to_string_dp (country. get_monthly_leadership_points (), 2 )
12361241 );
12371242
12381243 const fixed_point_t max_leadership_point_stockpile =
12391244 definition_manager.get_define_manager ().get_military_defines ().get_max_leadership_point_stockpile ();
1240- if (country-> get_leadership_point_stockpile () >= max_leadership_point_stockpile) {
1245+ if (country. get_leadership_point_stockpile () >= max_leadership_point_stockpile) {
12411246 leadership_tooltip += " \n " + get_tooltip_separator () + " \n " ;
12421247
12431248 static const StringName max_leadership_points_localisation_key = " TOPBAR_LEADERSHIP_MAX" ;
0 commit comments