diff options
author | hop311 <hop3114@gmail.com> | 2023-12-14 00:56:20 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-12-14 00:56:20 +0100 |
commit | 3b6be81fb327a9c5e7bcc7c2127f513048e67480 (patch) | |
tree | 83d5a86fe04594feada3c82258d9c08624e542be /src/openvic-simulation/misc | |
parent | 35e07b57aed9177be1bfeb7732ed8f17c71f2354 (diff) |
Removed modifier generating macros.
Diffstat (limited to 'src/openvic-simulation/misc')
-rw-r--r-- | src/openvic-simulation/misc/Modifier.cpp | 9 | ||||
-rw-r--r-- | src/openvic-simulation/misc/Modifier.hpp | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/openvic-simulation/misc/Modifier.cpp b/src/openvic-simulation/misc/Modifier.cpp index 2e9232b..40698e5 100644 --- a/src/openvic-simulation/misc/Modifier.cpp +++ b/src/openvic-simulation/misc/Modifier.cpp @@ -234,8 +234,13 @@ bool ModifierManager::setup_modifier_effects() { return ret; } -void ModifierManager::register_complex_modifier(std::string_view identifier) { - complex_modifiers.emplace(identifier); +bool ModifierManager::register_complex_modifier(std::string_view identifier) { + if (complex_modifiers.emplace(identifier).second) { + return true; + } else { + Logger::error("Duplicate complex modifier: ", identifier); + return false; + } } bool ModifierManager::add_event_modifier(std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon) { diff --git a/src/openvic-simulation/misc/Modifier.hpp b/src/openvic-simulation/misc/Modifier.hpp index a176d6c..f3a2499 100644 --- a/src/openvic-simulation/misc/Modifier.hpp +++ b/src/openvic-simulation/misc/Modifier.hpp @@ -129,7 +129,7 @@ namespace OpenVic { ModifierEffect::format_t format = ModifierEffect::format_t::PROPORTION_DECIMAL ); - void register_complex_modifier(std::string_view identifier); + bool register_complex_modifier(std::string_view identifier); bool setup_modifier_effects(); |