diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-10-30 23:41:44 +0100 |
---|---|---|
committer | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-11-01 16:27:42 +0100 |
commit | a1a9d2d6ce3c94bccf224efcffd4c7e11eebe1e1 (patch) | |
tree | b4f65a01c830f7e7c7cc10385a0442bfa05264a9 /extension/src/openvic-extension/singletons | |
parent | 2558a8fb10eb2f6adc01653bc0d4da73141efb67 (diff) |
Fix UI bindings after RGO PRfix_ui_binding_after_rgo_pr
Diffstat (limited to 'extension/src/openvic-extension/singletons')
-rw-r--r-- | extension/src/openvic-extension/singletons/MenuSingleton.cpp | 10 | ||||
-rw-r--r-- | extension/src/openvic-extension/singletons/PopulationMenu.cpp | 19 |
2 files changed, 16 insertions, 13 deletions
diff --git a/extension/src/openvic-extension/singletons/MenuSingleton.cpp b/extension/src/openvic-extension/singletons/MenuSingleton.cpp index 8d7f9fe..cabe82b 100644 --- a/extension/src/openvic-extension/singletons/MenuSingleton.cpp +++ b/extension/src/openvic-extension/singletons/MenuSingleton.cpp @@ -2,8 +2,10 @@ #include <godot_cpp/variant/utility_functions.hpp> +#include <openvic-simulation/economy/GoodDefinition.hpp> #include <openvic-simulation/GameManager.hpp> #include <openvic-simulation/modifier/Modifier.hpp> +#include <openvic-simulation/types/fixed_point/FixedPoint.hpp> #include "openvic-extension/classes/GFXPieChartTexture.hpp" #include "openvic-extension/classes/GUINode.hpp" @@ -472,10 +474,10 @@ Dictionary MenuSingleton::get_province_info_from_index(int32_t index) const { ret[province_info_controller_key] = Utilities::std_to_godot_string(controller->get_identifier()); } - GoodDefinition const* rgo = province->get_rgo(); - if (rgo != nullptr) { - ret[province_info_rgo_name_key] = Utilities::std_to_godot_string(rgo->get_identifier()); - ret[province_info_rgo_icon_key] = static_cast<int32_t>(rgo->get_index()); + GoodDefinition const* const rgo_good = province->get_rgo_good(); + if (rgo_good != nullptr) { + ret[province_info_rgo_name_key] = Utilities::std_to_godot_string(rgo_good->get_identifier()); + ret[province_info_rgo_icon_key] = static_cast<int32_t>(rgo_good->get_index()); } Crime const* crime = province->get_crime(); diff --git a/extension/src/openvic-extension/singletons/PopulationMenu.cpp b/extension/src/openvic-extension/singletons/PopulationMenu.cpp index 0c5a82d..700c57f 100644 --- a/extension/src/openvic-extension/singletons/PopulationMenu.cpp +++ b/extension/src/openvic-extension/singletons/PopulationMenu.cpp @@ -4,6 +4,7 @@ #include <openvic-simulation/DefinitionManager.hpp> #include <openvic-simulation/InstanceManager.hpp> +#include <openvic-simulation/types/fixed_point/FixedPoint.hpp> #include "openvic-extension/classes/GFXPieChartTexture.hpp" #include "openvic-extension/classes/GUINode.hpp" @@ -366,7 +367,7 @@ Error MenuSingleton::_population_menu_update_pops() { if (province_entry != nullptr && province_entry->selected) { for (Pop const& pop : province_entry->province.get_pops()) { population_menu.pops.push_back(&pop); - population_menu_t::pop_filter_t& filter = population_menu.pop_filters[&pop.get_type()]; + population_menu_t::pop_filter_t& filter = population_menu.pop_filters[pop.get_type()]; filter.count += pop.get_size(); // TODO - set filter.promotion_demotion_change } @@ -387,7 +388,7 @@ Error MenuSingleton::_population_menu_update_filtered_pops() { population_menu.vote_distribution.clear(); for (Pop const* pop : population_menu.pops) { - if (population_menu.pop_filters[&pop->get_type()].selected) { + if (population_menu.pop_filters[pop->get_type()].selected) { population_menu.filtered_pops.push_back(pop); } } @@ -395,12 +396,12 @@ Error MenuSingleton::_population_menu_update_filtered_pops() { for (Pop const* pop : population_menu.filtered_pops) { const fixed_point_t pop_size = fixed_point_t::parse(pop->get_size()); - population_menu.workforce_distribution[&pop->get_type()] += pop->get_size(); - population_menu.religion_distribution[&pop->get_religion()] += pop->get_size(); - population_menu.ideology_distribution += pop->get_ideologies() * fixed_point_t::parse(pop->get_size()); - population_menu.culture_distribution[&pop->get_culture()] += pop->get_size(); - population_menu.issue_distribution += pop->get_issues() * fixed_point_t::parse(pop->get_size()); - population_menu.vote_distribution += pop->get_votes() * fixed_point_t::parse(pop->get_size()); + population_menu.workforce_distribution[pop->get_type()] += pop_size; + population_menu.religion_distribution[&pop->get_religion()] += pop_size; + population_menu.ideology_distribution += pop->get_ideologies() * pop_size; + population_menu.culture_distribution[&pop->get_culture()] += pop_size; + population_menu.issue_distribution += pop->get_issues() * pop_size; + population_menu.vote_distribution += pop->get_votes() * pop_size; } normalise_fixed_point_map(population_menu.workforce_distribution); @@ -678,7 +679,7 @@ TypedArray<Dictionary> MenuSingleton::get_population_menu_pop_rows(int32_t start Dictionary pop_dict; pop_dict[pop_size_key] = pop->get_size(); - pop_dict[pop_type_icon_key] = pop->get_type().get_sprite(); + pop_dict[pop_type_icon_key] = pop->get_type()->get_sprite(); pop_dict[pop_culture_key] = Utilities::std_to_godot_string(pop->get_culture().get_identifier()); pop_dict[pop_religion_icon_key] = pop->get_religion().get_icon(); if (pop->get_location() != nullptr) { |