diff options
author | Hop311 <Hop3114@gmail.com> | 2023-12-13 21:09:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-13 21:09:27 +0100 |
commit | e79ad08e28c07bac5d28d0653cbe374cd51e6bbe (patch) | |
tree | 4dbbbc2c10b8bbc6670b36f3d4ecd4d5f7e765f9 /src/openvic-simulation/map/Map.cpp | |
parent | ce45aaae79199e07f9249799884cbba1b3d581eb (diff) | |
parent | 89c93f98b865c20cd3c3486a9b91323565e759fc (diff) |
Merge pull request #89 from OpenVicProject/dataloading-pop-history
Pop History Loading (with the new system)
Diffstat (limited to 'src/openvic-simulation/map/Map.cpp')
-rw-r--r-- | src/openvic-simulation/map/Map.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index 44443a4..b272f1f 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -294,8 +294,15 @@ bool Map::apply_history_to_provinces(ProvinceHistoryManager const& history_manag if (!province.get_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()); } } } |