diff options
author | hop311 <hop3114@gmail.com> | 2024-09-07 00:07:27 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-09-08 18:24:57 +0200 |
commit | 16349d6cad05497f983b1da123b6284ecfddd638 (patch) | |
tree | b22020c1221adc6633599a1ad53bf73bb62db0ad /src/openvic-simulation/map/State.cpp | |
parent | b5407c8794c4626d010bd0856a146095daa1042d (diff) |
Calculate country industrial power (states still need factory data)
Diffstat (limited to 'src/openvic-simulation/map/State.cpp')
-rw-r--r-- | src/openvic-simulation/map/State.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/openvic-simulation/map/State.cpp b/src/openvic-simulation/map/State.cpp index 68f2f43..90cbace 100644 --- a/src/openvic-simulation/map/State.cpp +++ b/src/openvic-simulation/map/State.cpp @@ -10,11 +10,19 @@ using namespace OpenVic; State::State( - StateSet const& new_state_set, CountryInstance* owner, ProvinceInstance* capital, - std::vector<ProvinceInstance*>&& provinces, ProvinceInstance::colony_status_t colony_status, + StateSet const& new_state_set, + CountryInstance* new_owner, + ProvinceInstance* new_capital, + std::vector<ProvinceInstance*>&& new_provinces, + ProvinceInstance::colony_status_t new_colony_status, decltype(pop_type_distribution)::keys_t const& pop_type_keys -) : state_set { new_state_set }, owner { owner }, capital { capital }, provinces { std::move(provinces) }, - colony_status { colony_status }, pop_type_distribution { &pop_type_keys } {} +) : state_set { new_state_set }, + owner { new_owner }, + capital { new_capital }, + provinces { std::move(new_provinces) }, + colony_status { new_colony_status }, + pop_type_distribution { &pop_type_keys }, + industrial_power { 0 } {} std::string State::get_identifier() const { return StringUtils::append_string_views( @@ -47,6 +55,16 @@ void State::update_gamestate() { average_consciousness /= total_population; average_militancy /= total_population; } + + // TODO - use actual values when State has factory data + const int32_t total_factory_levels_in_state = 0; + const int32_t potential_workforce_in_state = 0; // sum of worker pops, regardless of employment + const int32_t potential_employment_in_state = 0; // sum of (factory level * production method base_workforce_size) + + industrial_power = total_factory_levels_in_state * std::clamp( + (fixed_point_t { potential_workforce_in_state } / 100).floor() * 400 / potential_employment_in_state, + fixed_point_t::_0_20(), fixed_point_t::_4() + ); } /* Whether two provinces in the same region should be grouped into the same state or not. |