diff options
author | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-09-24 13:31:20 +0200 |
---|---|---|
committer | wvpm <24685035+wvpm@users.noreply.github.com> | 2024-09-24 13:31:20 +0200 |
commit | e0857a53fd01baf0774dba36c1b9d69f7b5bca35 (patch) | |
tree | 2b3c0cb6d42f15df1cbb9a3f0a029e763113081b /src/openvic-simulation/map | |
parent | c43ccc0cf61955a3ef4cccc8cbda38d730ea15ad (diff) |
Move rgo size calculation to rgo
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r-- | src/openvic-simulation/map/ProvinceInstance.cpp | 26 | ||||
-rw-r--r-- | src/openvic-simulation/map/ProvinceInstance.hpp | 3 |
2 files changed, 1 insertions, 28 deletions
diff --git a/src/openvic-simulation/map/ProvinceInstance.cpp b/src/openvic-simulation/map/ProvinceInstance.cpp index 7abb5cb..4282e7b 100644 --- a/src/openvic-simulation/map/ProvinceInstance.cpp +++ b/src/openvic-simulation/map/ProvinceInstance.cpp @@ -9,7 +9,6 @@ #include "openvic-simulation/misc/Define.hpp" #include "openvic-simulation/politics/Ideology.hpp" #include "openvic-simulation/pop/Pop.hpp" -#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" using namespace OpenVic; @@ -201,29 +200,6 @@ void ProvinceInstance::_update_pops(DefineManager const& define_manager) { } } -fixed_point_t ProvinceInstance::calculate_rgo_size(ProductionType const& production_type) const { - std::vector<Job> const& jobs = production_type.get_jobs(); - fixed_point_t total_worker_count_in_province = 0; //not counting equivalents - for(Pop const& pop : pops) { - bool is_worker_pop_type = false; - for(Job const& job : jobs) { - if(job.get_pop_type() == pop.get_type()) { - is_worker_pop_type = true; - break; - } - } - - if(is_worker_pop_type) { - total_worker_count_in_province += pop.get_size(); - } - } - - const fixed_point_t base_workforce_size = production_type.get_base_workforce_size(); - //TODO: if is_farm add farm size bonus - //TODO: if is_mine add mine size bonus - return ((total_worker_count_in_province / base_workforce_size).ceil() * fixed_point_t::_1_50()).floor(); -} - void ProvinceInstance::convert_rgo_worker_pops_to_equivalent(ProductionType const& production_type) { std::vector<Job> const& jobs = production_type.get_jobs(); fixed_point_t total_worker_count_in_province = 0; //not counting equivalents @@ -362,8 +338,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.set_size_multiplier(calculate_rgo_size(rgo_production_type)); rgo.set_production_type(&rgo_production_type); + rgo.update_size(*this); } void ProvinceInstance::setup_pop_test_values(IssueManager const& issue_manager) { diff --git a/src/openvic-simulation/map/ProvinceInstance.hpp b/src/openvic-simulation/map/ProvinceInstance.hpp index 281f19f..7e2754f 100644 --- a/src/openvic-simulation/map/ProvinceInstance.hpp +++ b/src/openvic-simulation/map/ProvinceInstance.hpp @@ -9,8 +9,6 @@ #include "openvic-simulation/pop/Pop.hpp" #include "openvic-simulation/types/HasIdentifier.hpp" #include "openvic-simulation/types/OrderedContainers.hpp" -#include "openvic-simulation/types/fixed_point/FixedPointMap.hpp" -#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" namespace OpenVic { @@ -99,7 +97,6 @@ namespace OpenVic { void _add_pop(Pop&& pop); void _update_pops(DefineManager const& define_manager); - fixed_point_t calculate_rgo_size(ProductionType const& production_type) const; void convert_rgo_worker_pops_to_equivalent(ProductionType const& production_type); public: |