diff options
author | hop311 <hop3114@gmail.com> | 2024-09-20 23:45:19 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-09-20 23:45:19 +0200 |
commit | 3fcdd0c7fce2de4cbe14a0cc3d6fb4c2731b93d9 (patch) | |
tree | 68fca0f77f6b20f3e1fe98d32a5a79311cfd3edc /src/openvic-simulation/modifier/Modifier.hpp | |
parent | 118570dc7cf9ae9daf324c2aaba5a5d86fb2c330 (diff) |
Add modifier type enummodifier-types
Diffstat (limited to 'src/openvic-simulation/modifier/Modifier.hpp')
-rw-r--r-- | src/openvic-simulation/modifier/Modifier.hpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/openvic-simulation/modifier/Modifier.hpp b/src/openvic-simulation/modifier/Modifier.hpp index f525d6a..80d2db6 100644 --- a/src/openvic-simulation/modifier/Modifier.hpp +++ b/src/openvic-simulation/modifier/Modifier.hpp @@ -79,6 +79,24 @@ namespace OpenVic { struct Modifier : HasIdentifier, ModifierValue { friend struct ModifierManager; + enum struct modifier_type_t : uint8_t { + EVENT, STATIC, TRIGGERED, CRIME, TERRAIN, CLIMATE, CONTINENT, BUILDING, LEADER, NATIONAL_VALUE, NATIONAL_FOCUS, + ISSUE, REFORM, TECHNOLOGY, INVENTION, TECH_SCHOOL + }; + + private: + const modifier_type_t PROPERTY(type); + + protected: + Modifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type); + + public: + Modifier(Modifier&&) = default; + }; + + struct IconModifier : Modifier { + friend struct ModifierManager; + using icon_t = uint8_t; private: @@ -86,13 +104,13 @@ namespace OpenVic { const icon_t PROPERTY(icon); protected: - Modifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon = 0); + IconModifier(std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type, icon_t new_icon); public: - Modifier(Modifier&&) = default; + IconModifier(IconModifier&&) = default; }; - struct TriggeredModifier : Modifier { + struct TriggeredModifier : IconModifier { friend struct ModifierManager; private: @@ -100,7 +118,8 @@ namespace OpenVic { protected: TriggeredModifier( - std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger + std::string_view new_identifier, ModifierValue&& new_values, modifier_type_t new_type, icon_t new_icon, + ConditionScript&& new_trigger ); bool parse_scripts(DefinitionManager const& definition_manager); @@ -131,7 +150,7 @@ namespace OpenVic { CaseInsensitiveIdentifierRegistry<ModifierEffect, RegistryStorageInfoDeque> IDENTIFIER_REGISTRY(modifier_effect); case_insensitive_string_set_t complex_modifiers; - IdentifierRegistry<Modifier> IDENTIFIER_REGISTRY(event_modifier); + IdentifierRegistry<IconModifier> IDENTIFIER_REGISTRY(event_modifier); IdentifierRegistry<Modifier> IDENTIFIER_REGISTRY(static_modifier); IdentifierRegistry<TriggeredModifier> IDENTIFIER_REGISTRY(triggered_modifier); @@ -155,14 +174,14 @@ namespace OpenVic { bool setup_modifier_effects(); - bool add_event_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon); + bool add_event_modifier(std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon); bool load_event_modifiers(ast::NodeCPtr root); bool add_static_modifier(std::string_view identifier, ModifierValue&& values); bool load_static_modifiers(ast::NodeCPtr root); bool add_triggered_modifier( - std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger + std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon, ConditionScript&& trigger ); bool load_triggered_modifiers(ast::NodeCPtr root); |