From 0f8bb5dad77730896f346abc5dddb92483bf4346 Mon Sep 17 00:00:00 2001 From: wvpm <24685035+wvpm@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:02:56 +0100 Subject: Always apply pop history --- src/openvic-simulation/map/MapInstance.cpp | 15 +++++++++------ 1 file 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); } } -- cgit v1.2.3-56-ga3b1