aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/modifier/ModifierSum.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-09-25 23:10:21 +0200
committer hop311 <hop3114@gmail.com>2024-10-05 22:48:41 +0200
commit4f9fd8a327b6de5fb32792a07453e9a2e245dc84 (patch)
treedc92397c8d16df21d612ad5159b8fd9b19353eb7 /src/openvic-simulation/modifier/ModifierSum.hpp
parentfb6b9439c219239691eb0201ec3f431b5dfe4893 (diff)
Add ModifierEffect targets
Diffstat (limited to 'src/openvic-simulation/modifier/ModifierSum.hpp')
-rw-r--r--src/openvic-simulation/modifier/ModifierSum.hpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/openvic-simulation/modifier/ModifierSum.hpp b/src/openvic-simulation/modifier/ModifierSum.hpp
index 81ae871..b982ed1 100644
--- a/src/openvic-simulation/modifier/ModifierSum.hpp
+++ b/src/openvic-simulation/modifier/ModifierSum.hpp
@@ -1,6 +1,9 @@
#pragma once
+#include <variant>
+
#include "openvic-simulation/modifier/Modifier.hpp"
+#include "openvic-simulation/types/fixed_point/FixedPoint.hpp"
namespace OpenVic {
struct CountryInstance;
@@ -13,10 +16,12 @@ namespace OpenVic {
Modifier const* modifier;
fixed_point_t multiplier;
modifier_source_t source;
+ ModifierEffect::target_t targets;
constexpr modifier_entry_t(
- Modifier const* new_modifier, fixed_point_t new_multiplier, modifier_source_t const& new_source
- ) : modifier { new_modifier }, multiplier { new_multiplier }, source { new_source } {}
+ Modifier const* new_modifier, fixed_point_t new_multiplier, modifier_source_t const& new_source,
+ ModifierEffect::target_t new_targets
+ ) : modifier { new_modifier }, multiplier { new_multiplier }, source { new_source }, targets { new_targets } {}
};
private:
@@ -25,7 +30,10 @@ namespace OpenVic {
public:
ModifierSum() = default;
+ ModifierSum(ModifierSum const&) = default;
ModifierSum(ModifierSum&&) = default;
+ ModifierSum& operator=(ModifierSum const&) = default;
+ ModifierSum& operator=(ModifierSum&&) = default;
void clear();
bool empty();
@@ -33,8 +41,12 @@ namespace OpenVic {
fixed_point_t get_effect(ModifierEffect const& effect, bool* effect_found = nullptr) const;
bool has_effect(ModifierEffect const& effect) const;
- void add_modifier(Modifier const& modifier, modifier_source_t source, fixed_point_t multiplier = fixed_point_t::_1());
+ void add_modifier(
+ Modifier const& modifier, modifier_source_t const& source, fixed_point_t multiplier = fixed_point_t::_1(),
+ ModifierEffect::target_t targets = ModifierEffect::target_t::ALL_TARGETS
+ );
void add_modifier_sum(ModifierSum const& modifier_sum);
+ void add_modifier_sum_filter_targets(ModifierSum const& modifier_sum, ModifierEffect::target_t targets);
void add_modifier_sum_exclude_source(ModifierSum const& modifier_sum, modifier_source_t const& excluded_source);
std::vector<modifier_entry_t> get_contributing_modifiers(ModifierEffect const& effect) const;