diff options
Diffstat (limited to 'src/openvic-simulation/misc')
-rw-r--r-- | src/openvic-simulation/misc/Event.hpp | 3 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Modifier.cpp | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/openvic-simulation/misc/Event.hpp b/src/openvic-simulation/misc/Event.hpp index 71957c4..c41ef3f 100644 --- a/src/openvic-simulation/misc/Event.hpp +++ b/src/openvic-simulation/misc/Event.hpp @@ -1,6 +1,7 @@ #pragma once #include "openvic-simulation/types/IdentifierRegistry.hpp" +#include "openvic-simulation/types/OrderedContainers.hpp" namespace OpenVic { struct EventManager; @@ -66,7 +67,7 @@ namespace OpenVic { struct OnAction : HasIdentifier { friend struct EventManager; - using weight_map_t = std::map<Event const*, uint64_t>; + using weight_map_t = ordered_map<Event const*, uint64_t>; private: weight_map_t PROPERTY(weighted_events); diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp index c86b121..94d38e0 100644 --- a/src/openvic-simulation/misc/Modifier.cpp +++ b/src/openvic-simulation/misc/Modifier.cpp @@ -1,6 +1,10 @@ #include "Modifier.hpp" + #include <string> +#include "openvic-simulation/types/OrderedContainers.hpp" +#include "openvic-simulation/utility/TslHelper.hpp" + using namespace OpenVic; using namespace OpenVic::NodeTools; @@ -16,7 +20,7 @@ ModifierValue& ModifierValue::operator=(ModifierValue const&) = default; ModifierValue& ModifierValue::operator=(ModifierValue&&) = default; void ModifierValue::trim() { - std::erase_if(values, [](effect_map_t::value_type const& value) -> bool { + erase_if(values, [](effect_map_t::value_type const& value) -> bool { return value.second == fixed_point_t::_0(); }); } @@ -57,7 +61,7 @@ ModifierValue ModifierValue::operator+(ModifierValue const& right) const { ModifierValue ModifierValue::operator-() const { ModifierValue ret = *this; - for (effect_map_t::value_type& value : ret.values) { + for (auto value : mutable_iterator(ret.values)) { value.second = -value.second; } return ret; |