diff options
author | Nemrav <> | 2024-09-17 18:44:23 +0200 |
---|---|---|
committer | Nemrav <> | 2024-09-17 18:44:23 +0200 |
commit | c232250cc9819ae8bf165a5707a926db928dcb2b (patch) | |
tree | 1067808ef3d362ddae62b8d5994138434c5b7178 /src/openvic-simulation/map/MapInstance.cpp | |
parent | f090f8f33a41d8707795c8963fa67073ba90f554 (diff) | |
parent | d8c04cbe53188d4717f8c49f918e01657dbf3440 (diff) |
Merge branch 'master' into gfxobject
Diffstat (limited to 'src/openvic-simulation/map/MapInstance.cpp')
-rw-r--r-- | src/openvic-simulation/map/MapInstance.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/openvic-simulation/map/MapInstance.cpp b/src/openvic-simulation/map/MapInstance.cpp index 56b3642..0ce8cea 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(); } } @@ -114,9 +118,9 @@ bool MapInstance::apply_history_to_provinces( return ret; } -void MapInstance::update_gamestate(Date today) { +void MapInstance::update_gamestate(Date today, DefineManager const& define_manager) { for (ProvinceInstance& province : province_instances.get_items()) { - province.update_gamestate(today); + province.update_gamestate(today, define_manager); } state_manager.update_gamestate(); |