From d67cd2d08fe2859809e35b93f5a8358c48a3705e Mon Sep 17 00:00:00 2001 From: hop311 Date: Fri, 6 Sep 2024 23:13:47 +0100 Subject: Calculate country military power (still needs modifiers + soldier pop supported regiment count) --- src/openvic-simulation/pop/Pop.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/openvic-simulation/pop/Pop.cpp') diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index 6dd0d1f..9221485 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -4,6 +4,7 @@ #include "openvic-simulation/country/CountryInstance.hpp" #include "openvic-simulation/map/ProvinceInstance.hpp" #include "openvic-simulation/military/UnitType.hpp" +#include "openvic-simulation/misc/Define.hpp" #include "openvic-simulation/politics/Ideology.hpp" #include "openvic-simulation/politics/Issue.hpp" #include "openvic-simulation/politics/Rebel.hpp" @@ -40,7 +41,8 @@ Pop::Pop(PopBase const& pop_base, decltype(ideologies)::keys_t const& ideology_k savings { 0 }, life_needs_fulfilled { 0 }, everyday_needs_fulfilled { 0 }, - luxury_needs_fulfilled { 0 } {} + luxury_needs_fulfilled { 0 }, + max_supported_regiments { 0 } {} void Pop::setup_pop_test_values(IssueManager const& issue_manager) { /* Returns +/- range% of size. */ @@ -125,6 +127,23 @@ void Pop::set_location(ProvinceInstance const& new_location) { } } +void Pop::update_gamestate( + DefineManager const& define_manager, CountryInstance const* owner, fixed_point_t const& pop_size_per_regiment_multiplier +) { + if (type.get_can_be_recruited()) { + if ( + size < define_manager.get_min_pop_size_for_regiment() || owner == nullptr || + !RegimentType::allowed_cultures_check_culture_in_country(owner->get_allowed_regiment_cultures(), culture, *owner) + ) { + max_supported_regiments = 0; + } else { + max_supported_regiments = (fixed_point_t::parse(size) / ( + fixed_point_t::parse(define_manager.get_pop_size_per_regiment()) * pop_size_per_regiment_multiplier + )).to_int64_t() + 1; + } + } +} + Strata::Strata(std::string_view new_identifier) : HasIdentifier { new_identifier } {} PopType::PopType( -- cgit v1.2.3-56-ga3b1