diff options
author | Hop311 <Hop3114@gmail.com> | 2024-06-18 21:30:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 21:30:42 +0200 |
commit | ace94963c36fb21288dbaf59b0191223adae6521 (patch) | |
tree | 3eb84f934534099aa89cfcbe67fd1098869a1ef0 /extension/src/openvic-extension/singletons/PopulationMenu.cpp | |
parent | 3dd525092e3a6027f20f0a1afdf8e871a9eecd34 (diff) | |
parent | 508a3ad82c9e20092ede373cdff7ec8d4ed9e881 (diff) |
Merge pull request #233 from OpenVicProject/map-instance
Update to use Map instance
Diffstat (limited to 'extension/src/openvic-extension/singletons/PopulationMenu.cpp')
-rw-r--r-- | extension/src/openvic-extension/singletons/PopulationMenu.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/extension/src/openvic-extension/singletons/PopulationMenu.cpp b/extension/src/openvic-extension/singletons/PopulationMenu.cpp index 4aeedae..3144a1a 100644 --- a/extension/src/openvic-extension/singletons/PopulationMenu.cpp +++ b/extension/src/openvic-extension/singletons/PopulationMenu.cpp @@ -20,8 +20,8 @@ void MenuSingleton::_population_menu_update_provinces() { population_menu.province_list_entries.clear(); population_menu.visible_province_list_entries = 0; - Map const& map = game_manager->get_map(); - ERR_FAIL_COND(!map.province_instances_are_locked()); + MapInstance const& map_instance = game_manager->get_map_instance(); + ERR_FAIL_COND(!map_instance.province_instances_are_locked()); for (Country const* country : { // Example country @@ -32,7 +32,7 @@ void MenuSingleton::_population_menu_update_provinces() { population_menu.province_list_entries.emplace_back(population_menu_t::country_entry_t { *country }); population_menu.visible_province_list_entries++; - for (StateSet const& state_set : map.get_state_manager().get_state_sets()) { + for (StateSet const& state_set : map_instance.get_state_manager().get_state_sets()) { for (State const& state : state_set.get_states()) { population_menu.province_list_entries.emplace_back(population_menu_t::state_entry_t { state }); @@ -163,7 +163,7 @@ TypedArray<Dictionary> MenuSingleton::get_population_menu_province_list_rows(int return true; } - } entry_visitor { *this, start, count, game_manager->get_map().get_total_map_population() }; + } entry_visitor { *this, start, count, game_manager->get_map_instance().get_total_map_population() }; while (entry_visitor.index < population_menu.province_list_entries.size() && std::visit(entry_visitor, population_menu.province_list_entries[entry_visitor.index])) { @@ -259,7 +259,9 @@ Error MenuSingleton::population_menu_select_province_list_entry(int32_t select_i Error MenuSingleton::population_menu_select_province(int32_t province_index) { ERR_FAIL_NULL_V(game_manager, FAILED); - ERR_FAIL_COND_V(province_index <= 0 || province_index > game_manager->get_map().get_province_instance_count(), FAILED); + ERR_FAIL_COND_V( + province_index <= 0 || province_index > game_manager->get_map_instance().get_province_instance_count(), FAILED + ); struct entry_visitor_t { |