-
Notifications
You must be signed in to change notification settings - Fork 8
Add type-safe pop_sum_t for large value sums of pops and refactor pop_size_t to be type-safe #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
cdaa3ff to
9fddcce
Compare
9fddcce to
f8b5c23
Compare
f8b5c23 to
3bdc2d4
Compare
7857b24 to
298ff10
Compare
| struct ProductionType; | ||
| struct ProvinceInstance; | ||
| struct RandomU32; | ||
| struct pop_size_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need this?
| "type", ZERO_OR_ONE, | ||
| expect_identifier(expect_mapped_string(template_type_map, assign_variable_callback(template_type))), | ||
| "workforce", ZERO_OR_ONE, expect_uint(assign_variable_callback(base_workforce_size)), | ||
| "workforce", ZERO_OR_ONE, expect_strong_typedef<pop_size_t>(assign_variable_callback(base_workforce_size)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you use pop_size_t here for Vic2 restrictions?
If so, we should use pop_size_t for base_workforce_size as well
If not, use pop_sum_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given #677 (comment), shouldn't we just make all production workforce size stuff use pop_size_t?
|
|
||
| const fixed_point_t size_modifier = calculate_size_modifier(); | ||
| const fixed_point_t base_workforce_size = production_type.base_workforce_size; | ||
| const fixed_point_t base_workforce_size = type_safe::get(production_type.base_workforce_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If base_workforce_size is uint64, it won't fit in a fixed_point_t.
Refactor pop_size_t to be type-safe 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 Fix ovdl::detail vs. OpenVic::detail namespace ambiguity in Dataloader.cpp
298ff10 to
3a4bd23
Compare
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_zeroFix ovdl::detail vs. OpenVic::detail namespace ambiguity in Dataloader.cpp