diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-10-30 22:08:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-30 22:08:36 +0100 |
commit | 5d8451172fefa93f6f53583fa6b8723f1dd3598e (patch) | |
tree | 187df50130475006b404c5ab57f0fa679173ad04 /src/openvic-simulation/map/MapInstance.cpp | |
parent | 48e4e92682db99239e928a67e6677cdd2c53a375 (diff) | |
parent | 0d861669d9e1f5d487c810ae01be50f142790f1e (diff) |
Merge pull request #206 from OpenVicProject/prepare_for_rgo
Prepare for rgo
Diffstat (limited to 'src/openvic-simulation/map/MapInstance.cpp')
-rw-r--r-- | src/openvic-simulation/map/MapInstance.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/MapInstance.cpp b/src/openvic-simulation/map/MapInstance.cpp index 47ae40e..4a4a1e5 100644 --- a/src/openvic-simulation/map/MapInstance.cpp +++ b/src/openvic-simulation/map/MapInstance.cpp @@ -93,6 +93,7 @@ bool MapInstance::apply_history_to_provinces( if (history_map != nullptr) { ProvinceHistoryEntry const* pop_history_entry = nullptr; + ProductionType const* rgo_production_type_nullable = nullptr; for (auto const& [entry_date, entry] : history_map->get_entries()) { if(entry_date > date) { @@ -101,6 +102,10 @@ bool MapInstance::apply_history_to_provinces( } } else { province.apply_history_to_province(*entry, country_manager); + std::optional<ProductionType const*> const& rgo_production_type_nullable_optional = entry->get_rgo_production_type_nullable(); + if (rgo_production_type_nullable_optional.has_value()) { + rgo_production_type_nullable = rgo_production_type_nullable_optional.value(); + } } if (!entry->get_pops().empty()) { @@ -114,6 +119,8 @@ bool MapInstance::apply_history_to_provinces( province.add_pop_vec(pop_history_entry->get_pops()); province.setup_pop_test_values(issue_manager); } + + ret&=province.set_rgo_production_type_nullable(rgo_production_type_nullable); } } } @@ -153,3 +160,9 @@ void MapInstance::tick(Date today) { province.tick(today); } } + +void MapInstance::initialise_for_new_game(ModifierEffectCache const& modifier_effect_cache){ + for (ProvinceInstance& province : province_instances.get_items()) { + province.initialise_for_new_game(modifier_effect_cache); + } +}
\ No newline at end of file |