aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/ProvinceInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/map/ProvinceInstance.cpp')
-rw-r--r--src/openvic-simulation/map/ProvinceInstance.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/openvic-simulation/map/ProvinceInstance.cpp b/src/openvic-simulation/map/ProvinceInstance.cpp
index 98e8fcb..e8361da 100644
--- a/src/openvic-simulation/map/ProvinceInstance.cpp
+++ b/src/openvic-simulation/map/ProvinceInstance.cpp
@@ -1,4 +1,5 @@
#include "ProvinceInstance.hpp"
+#include <cstddef>
#include "openvic-simulation/country/CountryInstance.hpp"
#include "openvic-simulation/economy/production/ProductionType.hpp"
@@ -27,7 +28,7 @@ ProvinceInstance::ProvinceInstance(
cores {},
slave { false },
crime { nullptr },
- rgo { nullptr },
+ rgo { ResourceGatheringOperation {} },
buildings { "buildings", false },
armies {},
navies {},
@@ -40,15 +41,15 @@ ProvinceInstance::ProvinceInstance(
max_supported_regiments { 0 } {}
GoodDefinition const* ProvinceInstance::get_rgo_good() const {
- if(rgo == nullptr) { return nullptr; }
- return rgo->get_production_type()->get_output_good();
+ if(!rgo.is_valid()) { 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);
+ rgo.set_production_type(&rgo_production_type);
}
bool ProvinceInstance::set_owner(CountryInstance* new_owner) {
@@ -362,10 +363,8 @@ bool ProvinceInstance::apply_history_to_province(ProvinceHistoryEntry const& ent
void ProvinceInstance::setup_rgo(ProductionType const& rgo_production_type) {
convert_rgo_worker_pops_to_equivalent(rgo_production_type);
- rgo = new ResourceGatheringOperation {
- &rgo_production_type,
- calculate_rgo_size(rgo_production_type)
- };
+ rgo.set_size_multiplier(calculate_rgo_size(rgo_production_type));
+ rgo.set_production_type(&rgo_production_type);
}
void ProvinceInstance::setup_pop_test_values(IssueManager const& issue_manager) {