From 6a99bd8237fa61bd740ba482b59ff428a7e2f123 Mon Sep 17 00:00:00 2001 From: hop311 Date: Tue, 19 Mar 2024 23:23:58 +0000 Subject: Add Pop attributes + generate test values --- src/openvic-simulation/map/Map.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/openvic-simulation/map/Map.cpp') 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; } -- cgit v1.2.3-56-ga3b1