From eca580673aec46cd6e730e7307c13afb858efd94 Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 23 Oct 2024 00:21:25 +0100 Subject: [Work-In-Progress] Add ModifierEffectMapping --- .../modifier/ModifierEffectMapping.hpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/openvic-simulation/modifier/ModifierEffectMapping.hpp (limited to 'src/openvic-simulation/modifier/ModifierEffectMapping.hpp') 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 + +#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 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; + }; +} -- cgit v1.2.3-56-ga3b1