aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/Modifier.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-12-02 16:48:08 +0100
committer hop311 <hop3114@gmail.com>2023-12-02 20:14:29 +0100
commit4a899c1a9e83ab9476b85522751081be434caa35 (patch)
treef1f6276c91beceecdfd9b09083d1c91ea8b41b60 /src/openvic-simulation/misc/Modifier.hpp
parentcd6875d5e0ca5e2545fd0e1647678cd18a6c81c2 (diff)
Crime+event modifier loading + misc UI backend
Diffstat (limited to 'src/openvic-simulation/misc/Modifier.hpp')
-rw-r--r--src/openvic-simulation/misc/Modifier.hpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/src/openvic-simulation/misc/Modifier.hpp b/src/openvic-simulation/misc/Modifier.hpp
index 9f14f41..9665e07 100644
--- a/src/openvic-simulation/misc/Modifier.hpp
+++ b/src/openvic-simulation/misc/Modifier.hpp
@@ -80,6 +80,32 @@ namespace OpenVic {
Modifier(Modifier&&) = default;
};
+ struct TriggeredModifier : Modifier {
+ friend struct ModifierManager;
+
+ private:
+ // TODO - trigger condition
+
+ protected:
+ TriggeredModifier(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon);
+
+ public:
+ TriggeredModifier(TriggeredModifier&&) = default;
+ };
+
+ struct Crime final : TriggeredModifier {
+ friend struct ModifierManager;
+
+ private:
+ const bool PROPERTY(default_active);
+ bool PROPERTY_RW(active);
+
+ Crime(std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, bool new_default_active);
+
+ public:
+ Crime(Crime&&) = default;
+ };
+
struct ModifierInstance {
private:
@@ -99,9 +125,13 @@ namespace OpenVic {
*/
private:
IdentifierInstanceRegistry<ModifierEffect> modifier_effects;
- IdentifierRegistry<Modifier> event_modifiers;
string_set_t complex_modifiers;
+ IdentifierRegistry<Crime> crime_modifiers;
+ IdentifierRegistry<Modifier> event_modifiers;
+ IdentifierRegistry<Modifier> static_modifiers;
+ IdentifierRegistry<TriggeredModifier> triggered_modifiers;
+
/* effect_validator takes in ModifierEffect const& */
NodeTools::key_value_callback_t _modifier_effect_callback(
ModifierValue& modifier, NodeTools::key_value_callback_t default_callback,
@@ -117,15 +147,24 @@ namespace OpenVic {
);
IDENTIFIER_REGISTRY_ACCESSORS(modifier_effect)
- bool add_event_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon);
- IDENTIFIER_REGISTRY_ACCESSORS(event_modifier)
void register_complex_modifier(std::string_view identifier);
bool setup_modifier_effects();
+ bool add_crime_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, bool active);
+ IDENTIFIER_REGISTRY_ACCESSORS(crime_modifier)
bool load_crime_modifiers(ast::NodeCPtr root);
+
+ bool add_event_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon);
+ IDENTIFIER_REGISTRY_ACCESSORS(event_modifier)
bool load_event_modifiers(ast::NodeCPtr root);
+
+ bool add_static_modifier(std::string_view identifier, ModifierValue&& values);
+ IDENTIFIER_REGISTRY_ACCESSORS(static_modifier)
bool load_static_modifiers(ast::NodeCPtr root);
+
+ bool add_triggered_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon);
+ IDENTIFIER_REGISTRY_ACCESSORS(triggered_modifier)
bool load_triggered_modifiers(ast::NodeCPtr root);
NodeTools::node_callback_t expect_validated_modifier_value_and_default(