aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop
diff options
context:
space:
mode:
author wvpm <24685035+wvpm@users.noreply.github.com>2024-09-18 17:37:44 +0200
committer wvpm <24685035+wvpm@users.noreply.github.com>2024-09-18 17:37:44 +0200
commit837dfc73574f0328a0987f3f7b96641d39317369 (patch)
tree90b901887b75cb9c2b61986b24356ebdaca46144 /src/openvic-simulation/pop
parentd8c04cbe53188d4717f8c49f918e01657dbf3440 (diff)
Reduce pop size to int32pop_size_int32
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r--src/openvic-simulation/pop/Pop.cpp4
-rw-r--r--src/openvic-simulation/pop/Pop.hpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp
index 9221485..cde7013 100644
--- a/src/openvic-simulation/pop/Pop.cpp
+++ b/src/openvic-simulation/pop/Pop.cpp
@@ -642,8 +642,8 @@ bool PopManager::load_pop_bases_into_vector(
*non_integer_size = true;
}
- if (culture != nullptr && religion != nullptr && size >= 1) {
- vec.emplace_back(PopBase { type, *culture, *religion, size.to_int64_t(), militancy, consciousness, rebel_type });
+ if (culture != nullptr && religion != nullptr && size >= 1 && size <= std::numeric_limits<Pop::pop_size_t>::max()) {
+ vec.emplace_back(PopBase { type, *culture, *religion, size.to_int32_t(), militancy, consciousness, rebel_type });
} else {
Logger::warning(
"Some pop arguments are invalid: culture = ", culture, ", religion = ", religion, ", size = ", size
diff --git a/src/openvic-simulation/pop/Pop.hpp b/src/openvic-simulation/pop/Pop.hpp
index e8cab42..59a7794 100644
--- a/src/openvic-simulation/pop/Pop.hpp
+++ b/src/openvic-simulation/pop/Pop.hpp
@@ -32,7 +32,7 @@ namespace OpenVic {
struct PopBase {
friend struct PopManager;
- using pop_size_t = int64_t;
+ using pop_size_t = int32_t;
protected:
PopType const& PROPERTY_ACCESS(type, protected);