From ab3b2b3e9aa502c7b03d30467b7d2eb682416d90 Mon Sep 17 00:00:00 2001 From: FarmingtonS9 Date: Sun, 10 Sep 2023 12:44:12 +1000 Subject: Added pop properties (size changes, literacy) --- src/openvic-simulation/pop/Pop.cpp | 9 +++------ src/openvic-simulation/pop/Pop.hpp | 13 +++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index be664d5..dd5bd83 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -17,16 +17,13 @@ using namespace OpenVic::NodeTools; Pop::Pop( PopType const& new_type, Culture const& new_culture, Religion const& new_religion, pop_size_t new_size, fixed_point_t new_militancy, fixed_point_t new_consciousness, RebelType const* new_rebel_type -) : type { new_type }, culture { new_culture }, religion { new_religion }, size { new_size }, num_promoted { 0 }, - num_demoted { 0 }, num_migrated { 0 }, militancy { new_militancy }, consciousness { new_consciousness }, +) : type { new_type }, culture { new_culture }, religion { new_religion }, size { new_size }, num_grown { 0 }, + num_promoted { 0 }, num_demoted { 0 }, num_migrated_internal { 0 }, num_migrated_external { 0 }, + num_migrated_colonial { 0 }, militancy { new_militancy }, consciousness { new_consciousness }, rebel_type { new_rebel_type } { assert(size > 0); } -Pop::pop_size_t Pop::get_pop_daily_change() const { - return Pop::get_num_promoted() - (Pop::get_num_demoted() + Pop::get_num_migrated()); -} - Strata::Strata(std::string_view new_identifier) : HasIdentifier { new_identifier } {} PopType::PopType( diff --git a/src/openvic-simulation/pop/Pop.hpp b/src/openvic-simulation/pop/Pop.hpp index 2304165..ffef6ea 100644 --- a/src/openvic-simulation/pop/Pop.hpp +++ b/src/openvic-simulation/pop/Pop.hpp @@ -5,6 +5,7 @@ #include "openvic-simulation/pop/Culture.hpp" #include "openvic-simulation/pop/Religion.hpp" #include "openvic-simulation/scripts/ConditionalWeight.hpp" +#include "openvic-simulation/types/fixed_point/FixedPoint.hpp" namespace OpenVic { @@ -30,12 +31,18 @@ namespace OpenVic { Culture const& PROPERTY(culture); Religion const& PROPERTY(religion); pop_size_t PROPERTY(size); - pop_size_t PROPERTY(num_promoted); + + /* Last day's size change by source. */ + pop_size_t PROPERTY(num_grown); + pop_size_t PROPERTY(num_promoted); // TODO - detailed promotion/demotion info (what to) pop_size_t PROPERTY(num_demoted); - pop_size_t PROPERTY(num_migrated); + pop_size_t PROPERTY(num_migrated_internal); // TODO - detailed migration info (where to) + pop_size_t PROPERTY(num_migrated_external); + pop_size_t PROPERTY(num_migrated_colonial); fixed_point_t PROPERTY(militancy); fixed_point_t PROPERTY(consciousness); + fixed_point_t PROPERTY(literacy); RebelType const* PROPERTY(rebel_type); Pop( @@ -48,8 +55,6 @@ namespace OpenVic { Pop(Pop&&) = default; Pop& operator=(Pop const&) = delete; Pop& operator=(Pop&&) = delete; - - pop_size_t get_pop_daily_change() const; }; struct Strata : HasIdentifier { -- cgit v1.2.3-56-ga3b1