|
1 | | -#include <concepts> //used in lambda |
| 1 | +#include <concepts> // IWYU pragma: keep for lambda |
2 | 2 | #include <cstddef> |
3 | 3 | #include <cstdint> |
4 | 4 | #include <ranges> |
|
10 | 10 | #undef KEEP_DO_FOR_ALL_TYPES_OF_EXPENSES |
11 | 11 |
|
12 | 12 | #include "openvic-simulation/country/CountryParty.hpp" |
13 | | -#include "openvic-simulation/country/CountryDefinition.hpp" //for ->get_parties() |
| 13 | +#include "openvic-simulation/country/CountryDefinition.hpp" |
14 | 14 | #include "openvic-simulation/country/CountryInstance.hpp" |
15 | 15 | #include "openvic-simulation/defines/Define.hpp" |
16 | 16 | #include "openvic-simulation/economy/GoodDefinition.hpp" |
|
32 | 32 | #include "openvic-simulation/pop/PopValuesFromProvince.hpp" |
33 | 33 | #include "openvic-simulation/pop/Religion.hpp" |
34 | 34 | #include "openvic-simulation/types/fixed_point/FixedPoint.hpp" |
| 35 | +#include "openvic-simulation/types/fixed_point/FixedPointMap.hpp" |
35 | 36 | #include "openvic-simulation/types/IndexedFlatMap.hpp" |
36 | 37 | #include "openvic-simulation/types/OrderedContainers.hpp" |
37 | | -#include "openvic-simulation/types/OrderedContainersMath.hpp" |
38 | 38 | #include "openvic-simulation/utility/Containers.hpp" |
39 | 39 | #include "openvic-simulation/utility/Logger.hpp" |
40 | 40 | #include "openvic-simulation/utility/Utility.hpp" |
@@ -180,7 +180,12 @@ void Pop::update_location_based_attributes() { |
180 | 180 | if (owner == nullptr) { |
181 | 181 | return; |
182 | 182 | } |
183 | | - auto view = owner->get_country_definition()->get_parties() | std::views::transform( |
| 183 | + CountryDefinition const* country_definition = owner ->get_country_definition(); |
| 184 | + if (country_definition == nullptr) { |
| 185 | + return; |
| 186 | + } |
| 187 | + |
| 188 | + auto view = country_definition->get_parties() | std::views::transform( |
184 | 189 | [](CountryParty const& key) { |
185 | 190 | return std::make_pair(&key, fixed_point_t::_0); |
186 | 191 | } |
|
0 commit comments