Skip to content

Conversation

@Spartan322
Copy link
Member

Move pop_size_t to population/PopSize.hpp
Add equalable to Concepts.hpp
Add expect_strong_typedef to NodeTools.hpp
Add && equalable<ValueType, OtherValueType> requirement to IndexedFlatMap's divide_assign_handle_zero

@Spartan322 Spartan322 force-pushed the refactor/pop-size-type branch 3 times, most recently from cdaa3ff to 9fddcce Compare December 5, 2025 20:39
#include <type_safe/strong_typedef.hpp>

namespace OpenVic {
struct pop_size_t : type_safe::strong_typedef<pop_size_t, std::int32_t>,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are probably flying close to the sun by picking uint32_t to store the pop size in. That comes out to a maximum value of about 4 billion, which is obviously more than enough for any single pop. However, you are likely to want to add up pop sizes for various demographic numbers, including over an entire nation in some cases, which has to accommodate world conquest. And even then 4 billion is probably enough for the base game, especially since they are real population numbers divided by 4. However, there are mods set in other periods (for example the modern day mods that cover the near future), and it is easy to imagine that the world population in those mods may at times exceed 16 billion given how pop growth works if you play them long enough.

Copy link
Member Author

@Spartan322 Spartan322 Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably a good argument to separate individual pop size storage and pop displayable size. Even then the display size would potentially have two versions even then, a signed and unsigned version as a 64-bit value, since there are some cases where negative values are necessary and others where it isn't.

Move pop_size_t to population/PopSize.hpp
Add equalable to Concepts.hpp
Add expect_strong_typedef to NodeTools.hpp
Add `&& equalable<ValueType, OtherValueType>` requirement to IndexedFlatMap's divide_assign_handle_zero
@Spartan322 Spartan322 force-pushed the refactor/pop-size-type branch from 9fddcce to f8b5c23 Compare December 6, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants