aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/modifier/ModifierEffectMapping.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-10-23 01:21:25 +0200
committer hop311 <hop3114@gmail.com>2024-10-23 01:21:25 +0200
commiteca580673aec46cd6e730e7307c13afb858efd94 (patch)
tree8ad859f8c3b4cad664a7a3e4cd93edbbed60bb5f /src/openvic-simulation/modifier/ModifierEffectMapping.hpp
parentc88cf59997529cbca008f9a2b629822de9deaa2a (diff)
[Work-In-Progress] Add ModifierEffectMappingmodifier-effect-mappings
Diffstat (limited to 'src/openvic-simulation/modifier/ModifierEffectMapping.hpp')
-rw-r--r--src/openvic-simulation/modifier/ModifierEffectMapping.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/openvic-simulation/modifier/ModifierEffectMapping.hpp b/src/openvic-simulation/modifier/ModifierEffectMapping.hpp
new file mode 100644
index 0000000..1042bb2
--- /dev/null
+++ b/src/openvic-simulation/modifier/ModifierEffectMapping.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <string_view>
+
+#include "openvic-simulation/types/OrderedContainers.hpp"
+#include "openvic-simulation/utility/Getters.hpp"
+
+namespace OpenVic {
+ struct ModifierManager;
+ struct ModifierEffect;
+
+ struct ModifierEffectMapping {
+ enum struct modifier_effect_mapping_type_t : uint8_t {
+ LEADER_MAPPING, // Isolated
+ TECHNOLOGY_MAPPING, // Isolated
+ UNIT_TERRAIN_MAPPING, // Isolated
+ BASE_COUNTRY_MAPPING, // Fallen back to by BASE_PROVINCE_MAPPING, and in turn by EVENT_MAPPING and TERRAIN_MAPPING
+ BASE_PROVINCE_MAPPING, // Falls back to BASE_COUNTRY_MAPPING, fallen back to by EVENT_MAPPING and TERRAIN_MAPPING
+ EVENT_MAPPING, // Falls back to BASE_PROVINCE_MAPPING
+ TERRAIN_MAPPING, // Falls back to BASE_PROVINCE_MAPPING
+ MODIFIER_EFFECT_MAPPING_COUNT
+ };
+
+ static std::string_view modifier_effect_mapping_type_to_string(modifier_effect_mapping_type_t type);
+
+ private:
+ const modifier_effect_mapping_type_t PROPERTY(type);
+ bool PROPERTY_CUSTOM_PREFIX(locked, is);
+ ModifierEffectMapping const* const PROPERTY(fallback_mapping);
+ string_map_t<ModifierEffect const*> PROPERTY(effect_map);
+
+ public:
+ ModifierEffectMapping(
+ modifier_effect_mapping_type_t new_type, ModifierEffectMapping const* new_fallback_mapping = nullptr
+ );
+ ModifierEffectMapping(ModifierEffectMapping&&) = default;
+
+ std::string_view get_type_name() const;
+
+ bool add_modifier_effect(ModifierEffect const& effect);
+ void lock();
+
+ ModifierEffect const* lookup_modifier_effect(std::string_view identifier) const;
+ };
+}