diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-10-30 21:43:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-30 21:43:06 +0100 |
commit | 48e4e92682db99239e928a67e6677cdd2c53a375 (patch) | |
tree | 5186d4c6b79525a1dc2b3655a4a556bcc22405cc /src/openvic-simulation | |
parent | 309deb6a5b28c8e2b24e73d06f1418bb992b4cd7 (diff) | |
parent | 0f8bb5dad77730896f346abc5dddb92483bf4346 (diff) |
Merge pull request #219 from OpenVicProject/always_apply_pop_history
Always apply pop history
Diffstat (limited to 'src/openvic-simulation')
-rw-r--r-- | src/openvic-simulation/map/MapInstance.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/openvic-simulation/map/MapInstance.cpp b/src/openvic-simulation/map/MapInstance.cpp index d8ec2fb..47ae40e 100644 --- a/src/openvic-simulation/map/MapInstance.cpp +++ b/src/openvic-simulation/map/MapInstance.cpp @@ -95,20 +95,23 @@ bool MapInstance::apply_history_to_provinces( ProvinceHistoryEntry const* pop_history_entry = nullptr; for (auto const& [entry_date, entry] : history_map->get_entries()) { - if (entry_date > date) { - break; + if(entry_date > date) { + if(pop_history_entry != nullptr) { + break; + } + } else { + province.apply_history_to_province(*entry, country_manager); } - province.apply_history_to_province(*entry, country_manager); - if (!entry->get_pops().empty()) { pop_history_entry = entry.get(); } } - if (pop_history_entry != nullptr) { + if (pop_history_entry == nullptr) { + Logger::warning("No pop history entry for province ",province.get_identifier(), " for date ", date.to_string()); + } else { province.add_pop_vec(pop_history_entry->get_pops()); - province.setup_pop_test_values(issue_manager); } } |