aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/pop/Pop.cpp
diff options
context:
space:
mode:
author Steve Frampton <40193522+FarmingtonS9@users.noreply.github.com>2023-08-20 19:17:17 +0200
committer GitHub <noreply@github.com>2023-08-20 19:17:17 +0200
commitbec619fc8f554cb075fcef2428f3b6bdb5e88e82 (patch)
tree826be63abdae21b49b4b2d02b98fc9adbe806227 /src/openvic/pop/Pop.cpp
parent383ef70bea656a77e8b7c6843fd4a79705ecde49 (diff)
Added pop properties + changes to pop_size_t type (#13)
* Added additional pop properties REQ POP-34, POP-35, POP-36, POP-37. Introducing new PopType properties for purpose of developing initial promotion system. * Addendum to previous commit Forgot to save file. Previous statement still accurate. * Added additional pop properties REQ POP-34, POP-35, POP-36, POP-37. Introducing new PopType properties for purpose of developing initial promotion system. * Addendum to previous commit Forgot to save file. Previous statement still accurate. * Changed pop_size_t to int64 type Modified pop_size_t to be an int64, consolidating u_int32_t and int32_t. * Move PopType struct attributes to Pop struct attributes Moved: - num_promoted - num_demoted - num_migrated attributes to Pop struct from PopType struct. Added relevant parameters to Pop constructor. Fixed/moved related functions to Pop struct. * Updated/fixed previous commit Removed parameters from Pop construct.
Diffstat (limited to 'src/openvic/pop/Pop.cpp')
-rw-r--r--src/openvic/pop/Pop.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/openvic/pop/Pop.cpp b/src/openvic/pop/Pop.cpp
index c4b11b8..81915f6 100644
--- a/src/openvic/pop/Pop.cpp
+++ b/src/openvic/pop/Pop.cpp
@@ -31,6 +31,22 @@ Pop::pop_size_t Pop::get_size() const {
return size;
}
+Pop::pop_size_t Pop::get_num_promoted() const {
+ return num_promoted;
+}
+
+Pop::pop_size_t Pop::get_num_demoted() const {
+ return num_demoted;
+}
+
+Pop::pop_size_t Pop::get_num_migrated() const {
+ return num_migrated;
+}
+
+Pop::pop_size_t Pop::get_pop_daily_change() const {
+ return Pop::get_num_promoted() - (Pop::get_num_demoted() + Pop::get_num_migrated());
+}
+
PopType::PopType(const std::string_view new_identifier, colour_t new_colour,
strata_t new_strata, sprite_t new_sprite,
Pop::pop_size_t new_max_size, Pop::pop_size_t new_merge_max_size,
@@ -53,6 +69,10 @@ PopType::sprite_t PopType::get_sprite() const {
return sprite;
}
+PopType::strata_t PopType::get_strata() const {
+ return strata;
+}
+
Pop::pop_size_t PopType::get_max_size() const {
return max_size;
}
@@ -86,6 +106,7 @@ static const std::string test_pop_type_poor = "test_pop_type_poor";
static const std::string test_pop_type_middle = "test_pop_type_middle";
static const std::string test_pop_type_rich = "test_pop_type_rich";
+
PopManager::PopManager() : pop_types { "pop types" } {
culture_manager.add_graphical_culture_type(test_graphical_culture_type);
culture_manager.lock_graphical_culture_types();
@@ -149,6 +170,7 @@ void PopManager::generate_test_pops(Province& province) const {
static PopType const& type_rich = *get_pop_type_by_identifier(test_pop_type_rich);
static Culture const& culture = *culture_manager.get_culture_by_identifier(test_culture);
static Religion const& religion = *religion_manager.get_religion_by_identifier(test_religion);
+
province.add_pop({ type_poor, culture, religion, static_cast<Pop::pop_size_t>(province.get_index() * province.get_index()) * 100 });
province.add_pop({ type_middle, culture, religion, static_cast<Pop::pop_size_t>(province.get_index() * province.get_index()) * 50 });
province.add_pop({ type_rich, culture, religion, static_cast<Pop::pop_size_t>(province.get_index()) * 1000 });