diff options
author | hop311 <hop3114@gmail.com> | 2024-07-17 00:57:50 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-07-17 00:58:05 +0200 |
commit | f83e869def6608f64606aead24ad1cfbb6f5c72a (patch) | |
tree | fae6a1086f3ae698c4fb3f18340c5ed5f580c889 /src/openvic-simulation/map/MapInstance.cpp | |
parent | e8a3b33f13ebdf3a388b4996308b4db9763dc375 (diff) |
Add IndexedMap and use in low key count, high value density casesindexed-map
Diffstat (limited to 'src/openvic-simulation/map/MapInstance.cpp')
-rw-r--r-- | src/openvic-simulation/map/MapInstance.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/openvic-simulation/map/MapInstance.cpp b/src/openvic-simulation/map/MapInstance.cpp index 1547ade..986b102 100644 --- a/src/openvic-simulation/map/MapInstance.cpp +++ b/src/openvic-simulation/map/MapInstance.cpp @@ -49,7 +49,11 @@ ProvinceDefinition::index_t MapInstance::get_selected_province_index() const { : ProvinceDefinition::NULL_INDEX; } -bool MapInstance::setup(BuildingTypeManager const& building_type_manager) { +bool MapInstance::setup( + BuildingTypeManager const& building_type_manager, + decltype(ProvinceInstance::pop_type_distribution)::keys_t const& pop_type_keys, + decltype(ProvinceInstance::ideology_distribution)::keys_t const& ideology_keys +) { if (province_instances_are_locked()) { Logger::error("Cannot setup map - province instances are locked!"); return false; @@ -64,7 +68,7 @@ bool MapInstance::setup(BuildingTypeManager const& building_type_manager) { province_instances.reserve(map_definition.get_province_definition_count()); for (ProvinceDefinition const& province : map_definition.get_province_definitions()) { - ret &= province_instances.add_item({ province }); + ret &= province_instances.add_item({ province, pop_type_keys, ideology_keys }); } province_instances.lock(); @@ -85,8 +89,7 @@ bool MapInstance::setup(BuildingTypeManager const& building_type_manager) { } bool MapInstance::apply_history_to_provinces( - ProvinceHistoryManager const& history_manager, Date date, IdeologyManager const& ideology_manager, - IssueManager const& issue_manager, CountryDefinition const& country + ProvinceHistoryManager const& history_manager, Date date, IssueManager const& issue_manager ) { bool ret = true; @@ -109,7 +112,7 @@ bool MapInstance::apply_history_to_provinces( if (pop_history_entry != nullptr) { province.add_pop_vec(pop_history_entry->get_pops()); - province.setup_pop_test_values(ideology_manager, issue_manager, country); + province.setup_pop_test_values(issue_manager); } } } |