diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-09-22 15:18:20 +0200 |
---|---|---|
committer | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-09-22 15:18:20 +0200 |
commit | bb11416cb9f1b1a626a84ec86cb64a466c99182a (patch) | |
tree | ca611284801e094c8d98b380ae5eb1424296ca85 /src/openvic-simulation | |
parent | cf3bbdfddaf05f0439e9aeb6cce9d2bef5b47f53 (diff) |
Also convert pops when changing rgo
Diffstat (limited to 'src/openvic-simulation')
-rw-r--r-- | src/openvic-simulation/map/ProvinceInstance.cpp | 25 | ||||
-rw-r--r-- | src/openvic-simulation/map/ProvinceInstance.hpp | 2 |
2 files changed, 12 insertions, 15 deletions
diff --git a/src/openvic-simulation/map/ProvinceInstance.cpp b/src/openvic-simulation/map/ProvinceInstance.cpp index 9e7fd6e..ffcdfa1 100644 --- a/src/openvic-simulation/map/ProvinceInstance.cpp +++ b/src/openvic-simulation/map/ProvinceInstance.cpp @@ -39,20 +39,17 @@ ProvinceInstance::ProvinceInstance( religion_distribution {}, max_supported_regiments { 0 } {} - GoodDefinition const* ProvinceInstance::get_rgo_good() const { - if(rgo == nullptr) { return nullptr; } - return rgo->get_production_type()->get_output_good(); - } - void ProvinceInstance::set_rgo_production_type(ProductionType const& production_type) { - if(production_type.get_template_type() != ProductionType::template_type_t::RGO) { - //error - } - - //recalculate rgo size? - //convert pops farmers <> labourers - - rgo->set_production_type(&production_type); - } +GoodDefinition const* ProvinceInstance::get_rgo_good() const { + if(rgo == nullptr) { return nullptr; } + return rgo->get_production_type()->get_output_good(); +} +void ProvinceInstance::set_rgo_production_type(ProductionType const& rgo_production_type) { + if(rgo_production_type.get_template_type() != ProductionType::template_type_t::RGO) { + //error + } + convert_rgo_worker_pops_to_equivalent(rgo_production_type); + rgo->set_production_type(&rgo_production_type); +} bool ProvinceInstance::set_owner(CountryInstance* new_owner) { bool ret = true; diff --git a/src/openvic-simulation/map/ProvinceInstance.hpp b/src/openvic-simulation/map/ProvinceInstance.hpp index c8168a9..f1d4b75 100644 --- a/src/openvic-simulation/map/ProvinceInstance.hpp +++ b/src/openvic-simulation/map/ProvinceInstance.hpp @@ -120,7 +120,7 @@ namespace OpenVic { } GoodDefinition const* get_rgo_good() const; - void set_rgo_production_type(ProductionType const& production_type); + void set_rgo_production_type(ProductionType const& rgo_production_type); bool set_owner(CountryInstance* new_owner); bool set_controller(CountryInstance* new_controller); |