diff options
Diffstat (limited to 'src/openvic-simulation')
-rw-r--r-- | src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp b/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp index ef20db8..904ed38 100644 --- a/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp +++ b/src/openvic-simulation/economy/production/ResourceGatheringOperation.cpp @@ -1,7 +1,10 @@ #include "ResourceGatheringOperation.hpp" #include "openvic-simulation/pop/Pop.hpp" #include "openvic-simulation/map/ProvinceInstance.hpp" +#include "openvic-simulation/map/TerrainType.hpp" +#include "openvic-simulation/modifier/Modifier.hpp" #include "openvic-simulation/types/fixed_point/FixedPoint.hpp" +#include "openvic-simulation/economy/production/ProductionType.hpp" using namespace OpenVic; @@ -31,7 +34,8 @@ void ResourceGatheringOperation::update_size(ProvinceInstance const& location) { size_multiplier = fixed_point_t::_0(); } else { - std::vector<Job> const& jobs = production_type->get_jobs(); + ProductionType const& production_type = *(this->production_type); + 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 : location.get_pops()) { bool is_worker_pop_type = false; @@ -47,9 +51,17 @@ void ResourceGatheringOperation::update_size(ProvinceInstance const& location) { } } - 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 + const fixed_point_t base_workforce_size = production_type.get_base_workforce_size(); + TerrainType const* const terrain_type = location.get_terrain_type(); + if(terrain_type != nullptr) { + ModifierValue const& terrain_modifiers = terrain_type->get_modifier(); + if(production_type.is_farm()) { + //base_workforce_size *= terrain_modifiers["farm_rgo_size"]; + } + if(production_type.is_mine()) { + //base_workforce_size *= terrain_modifiers["mine_rgo_size"]; + } + } size_multiplier = ((total_worker_count_in_province / base_workforce_size).ceil() * fixed_point_t::_1_50()).floor(); } }
\ No newline at end of file |