diff options
author | Hop311 <Hop3114@gmail.com> | 2024-08-30 23:29:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-30 23:29:03 +0200 |
commit | 6c88ecaf2d158dfff1e0b88f0509782e1a15ae3d (patch) | |
tree | 894e8c0514a572bb4cc64216f40833995660b22d /src/openvic-simulation/types | |
parent | 68fca4f504e7f178f69d0dfd64e90ffb1d579322 (diff) | |
parent | 8d5068c1db9a02a34d675536f41aee61ec3e482a (diff) |
Merge pull request #188 from OpenVicProject/gov-flag-type
Load government flag overrides from history and apply them
Diffstat (limited to 'src/openvic-simulation/types')
-rw-r--r-- | src/openvic-simulation/types/IndexedMap.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/openvic-simulation/types/IndexedMap.hpp b/src/openvic-simulation/types/IndexedMap.hpp index 30cf5cd..5682c0e 100644 --- a/src/openvic-simulation/types/IndexedMap.hpp +++ b/src/openvic-simulation/types/IndexedMap.hpp @@ -169,6 +169,16 @@ namespace OpenVic { return true; } + constexpr void write_non_empty_values(IndexedMap const& other) { + const size_t count = std::min(container_t::size(), other.size()); + for (size_t index = 0; index < count; ++index) { + value_t const& value = other[index]; + if (value) { + container_t::operator[](index) = value; + } + } + } + fixed_point_map_t<key_t const *> to_fixed_point_map() const requires(std::same_as<value_t, fixed_point_t>) { |