diff options
author | hop311 <hop3114@gmail.com> | 2024-10-01 00:23:35 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-10-05 22:48:42 +0200 |
commit | ba4fe5d9a8596e1b73a3aa0735d471e25493d54b (patch) | |
tree | a760bb0c72e6ab2f135f7d003391a1f1f9245753 /src/openvic-simulation/modifier/Modifier.hpp | |
parent | f3f364f08cc8f1c80a5dfce689183c2f8f75bbd4 (diff) |
Cache modifier effects in dedicated variables
Diffstat (limited to 'src/openvic-simulation/modifier/Modifier.hpp')
-rw-r--r-- | src/openvic-simulation/modifier/Modifier.hpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/openvic-simulation/modifier/Modifier.hpp b/src/openvic-simulation/modifier/Modifier.hpp index 28e56cd..49194cd 100644 --- a/src/openvic-simulation/modifier/Modifier.hpp +++ b/src/openvic-simulation/modifier/Modifier.hpp @@ -1,6 +1,7 @@ #pragma once #include "openvic-simulation/modifier/ModifierEffect.hpp" +#include "openvic-simulation/modifier/ModifierEffectCache.hpp" #include "openvic-simulation/modifier/ModifierValue.hpp" #include "openvic-simulation/modifier/StaticModifierCache.hpp" #include "openvic-simulation/scripts/ConditionScript.hpp" @@ -74,6 +75,12 @@ namespace OpenVic { struct ModifierManager { friend struct StaticModifierCache; + friend struct BuildingTypeManager; + friend struct GoodDefinitionManager; + friend struct UnitTypeManager; + friend struct RebelManager; + friend struct PopManager; + friend struct TechnologyManager; /* Some ModifierEffects are generated mid-load, such as max/min count modifiers for each building, so * we can't lock it until loading is over. This means we can't rely on locking for pointer stability, @@ -87,6 +94,7 @@ namespace OpenVic { IdentifierRegistry<Modifier> IDENTIFIER_REGISTRY(static_modifier); IdentifierRegistry<TriggeredModifier> IDENTIFIER_REGISTRY(triggered_modifier); + ModifierEffectCache PROPERTY(modifier_effect_cache); StaticModifierCache PROPERTY(static_modifier_cache); /* effect_validator takes in ModifierEffect const& */ @@ -97,7 +105,9 @@ namespace OpenVic { public: bool add_modifier_effect( - std::string_view identifier, bool positive_good, + ModifierEffect const*& effect_cache, + std::string_view identifier, + bool positive_good, ModifierEffect::format_t format, ModifierEffect::target_t targets, std::string_view localisation_key = {} |