diff options
Diffstat (limited to 'src/openvic-simulation/map/Map.cpp')
-rw-r--r-- | src/openvic-simulation/map/Map.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index f87246f..81a599e 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -446,25 +446,36 @@ bool Map::reset(BuildingTypeManager const& building_type_manager) { return ret; } -bool Map::apply_history_to_provinces(ProvinceHistoryManager const& history_manager, Date date) { +bool Map::apply_history_to_provinces( + ProvinceHistoryManager const& history_manager, Date date, IdeologyManager const& ideology_manager, + IssueManager const& issue_manager, Country const& country +) { bool ret = true; + for (Province& province : provinces.get_items()) { if (!province.is_water()) { ProvinceHistoryMap const* history_map = history_manager.get_province_history(&province); + if (history_map != nullptr) { ProvinceHistoryEntry const* pop_history_entry = nullptr; + for (ProvinceHistoryEntry const* entry : history_map->get_entries_up_to(date)) { province.apply_history_to_province(entry); + if (!entry->get_pops().empty()) { pop_history_entry = entry; } } + if (pop_history_entry != nullptr) { province.add_pop_vec(pop_history_entry->get_pops()); + + province.setup_pop_test_values(ideology_manager, issue_manager, country); } } } } + return ret; } |