aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop/Pop.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-09-07 00:13:47 +0200
committer hop311 <hop3114@gmail.com>2024-09-09 19:25:27 +0200
commitd67cd2d08fe2859809e35b93f5a8358c48a3705e (patch)
treee3f5b453affdb38e5a0c08513c404de652fce738 /src/openvic-simulation/pop/Pop.cpp
parent16349d6cad05497f983b1da123b6284ecfddd638 (diff)
Calculate country military power (still needs modifiers + soldier pop supported regiment count)ranking
Diffstat (limited to 'src/openvic-simulation/pop/Pop.cpp')
-rw-r--r--src/openvic-simulation/pop/Pop.cpp21
1 files changed, 20 insertions, 1 deletions
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(