aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Map.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-03-21 00:31:05 +0100
committer GitHub <noreply@github.com>2024-03-21 00:31:05 +0100
commit020ada6c8f0f1bf4486fd9e76ec29673044794d6 (patch)
tree5dc9698964d3980680dad3127fb53ecd4a600c5f /src/openvic-simulation/map/Map.cpp
parenteece77afebf0e4d36b4c9ace3b1044f2c3da50f1 (diff)
parent6a99bd8237fa61bd740ba482b59ff428a7e2f123 (diff)
Merge pull request #152 from OpenVicProject/pop-menu
GUI and Pop attribute work for Population Menu
Diffstat (limited to 'src/openvic-simulation/map/Map.cpp')
-rw-r--r--src/openvic-simulation/map/Map.cpp13
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;
}