aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/MapInstance.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-09-07 00:07:27 +0200
committer hop311 <hop3114@gmail.com>2024-09-08 18:24:57 +0200
commit16349d6cad05497f983b1da123b6284ecfddd638 (patch)
treeb22020c1221adc6633599a1ad53bf73bb62db0ad /src/openvic-simulation/map/MapInstance.cpp
parentb5407c8794c4626d010bd0856a146095daa1042d (diff)
Calculate country industrial power (states still need factory data)
Diffstat (limited to 'src/openvic-simulation/map/MapInstance.cpp')
-rw-r--r--src/openvic-simulation/map/MapInstance.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/openvic-simulation/map/MapInstance.cpp b/src/openvic-simulation/map/MapInstance.cpp
index 56b3642..ea174eb 100644
--- a/src/openvic-simulation/map/MapInstance.cpp
+++ b/src/openvic-simulation/map/MapInstance.cpp
@@ -94,11 +94,15 @@ bool MapInstance::apply_history_to_provinces(
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, country_manager);
+ for (auto const& [entry_date, entry] : history_map->get_entries()) {
+ if (entry_date > date) {
+ break;
+ }
+
+ province.apply_history_to_province(*entry, country_manager);
if (!entry->get_pops().empty()) {
- pop_history_entry = entry;
+ pop_history_entry = entry.get();
}
}