diff options
author | Hop311 <Hop3114@gmail.com> | 2024-07-17 19:20:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-17 19:20:15 +0200 |
commit | 6c92fc141c3e44526be43720a342beedeab9ad63 (patch) | |
tree | aa6e018034c4c0fd498e74707d5cc3750c0dd438 /extension/src/openvic-extension/singletons/MenuSingleton.cpp | |
parent | 114394f4d1bcf5249089b6e3632d259a195ec584 (diff) | |
parent | 928c521599b2b18e8964aeb445c3ca5a55bacbd1 (diff) |
Merge pull request #239 from OpenVicProject/indexed-map
Use IndexedMap + helper function support
Diffstat (limited to 'extension/src/openvic-extension/singletons/MenuSingleton.cpp')
-rw-r--r-- | extension/src/openvic-extension/singletons/MenuSingleton.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/extension/src/openvic-extension/singletons/MenuSingleton.cpp b/extension/src/openvic-extension/singletons/MenuSingleton.cpp index b4baf40..36e5f58 100644 --- a/extension/src/openvic-extension/singletons/MenuSingleton.cpp +++ b/extension/src/openvic-extension/singletons/MenuSingleton.cpp @@ -226,19 +226,22 @@ Dictionary MenuSingleton::get_province_info_from_index(int32_t index) const { ret[province_info_total_population_key] = province->get_total_population(); - fixed_point_map_t<PopType const*> const& pop_types = province->get_pop_type_distribution(); - if (!pop_types.empty()) { - ret[province_info_pop_types_key] = GFXPieChartTexture::distribution_to_slices_array(pop_types); + GFXPieChartTexture::godot_pie_chart_data_t pop_types = + GFXPieChartTexture::distribution_to_slices_array(province->get_pop_type_distribution()); + if (!pop_types.is_empty()) { + ret[province_info_pop_types_key] = std::move(pop_types); } - fixed_point_map_t<Ideology const*> const& ideologies = province->get_ideology_distribution(); - if (!ideologies.empty()) { - ret[province_info_pop_ideologies_key] = GFXPieChartTexture::distribution_to_slices_array(ideologies); + GFXPieChartTexture::godot_pie_chart_data_t ideologies = + GFXPieChartTexture::distribution_to_slices_array(province->get_ideology_distribution()); + if (!ideologies.is_empty()) { + ret[province_info_pop_ideologies_key] = std::move(ideologies); } - fixed_point_map_t<Culture const*> const& cultures = province->get_culture_distribution(); - if (!cultures.empty()) { - ret[province_info_pop_cultures_key] = GFXPieChartTexture::distribution_to_slices_array(cultures); + GFXPieChartTexture::godot_pie_chart_data_t cultures = + GFXPieChartTexture::distribution_to_slices_array(province->get_culture_distribution()); + if (!cultures.is_empty()) { + ret[province_info_pop_cultures_key] = std::move(cultures); } std::vector<CountryDefinition const*> const& cores = province->get_cores(); |