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/map/Crime.cpp | |
parent | 118570dc7cf9ae9daf324c2aaba5a5d86fb2c330 (diff) |
Add modifier type enummodifier-types
Diffstat (limited to 'src/openvic-simulation/map/Crime.cpp')
-rw-r--r-- | src/openvic-simulation/map/Crime.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/openvic-simulation/map/Crime.cpp b/src/openvic-simulation/map/Crime.cpp index 03da0fc..fb521ad 100644 --- a/src/openvic-simulation/map/Crime.cpp +++ b/src/openvic-simulation/map/Crime.cpp @@ -6,16 +6,18 @@ using namespace OpenVic::NodeTools; Crime::Crime( std::string_view new_identifier, ModifierValue&& new_values, icon_t new_icon, ConditionScript&& new_trigger, bool new_default_active -) : TriggeredModifier { new_identifier, std::move(new_values), new_icon, std::move(new_trigger) }, +) : TriggeredModifier { new_identifier, std::move(new_values), modifier_type_t::CRIME, new_icon, std::move(new_trigger) }, default_active { new_default_active } {} bool CrimeManager::add_crime_modifier( - std::string_view identifier, ModifierValue&& values, Modifier::icon_t icon, ConditionScript&& trigger, bool default_active + std::string_view identifier, ModifierValue&& values, IconModifier::icon_t icon, ConditionScript&& trigger, + bool default_active ) { if (identifier.empty()) { Logger::error("Invalid crime modifier effect identifier - empty!"); return false; } + return crime_modifiers.add_item( { identifier, std::move(values), icon, std::move(trigger), default_active }, duplicate_warning_callback ); @@ -26,7 +28,7 @@ bool CrimeManager::load_crime_modifiers(ModifierManager const& modifier_manager, crime_modifiers, [this, &modifier_manager](std::string_view key, ast::NodeCPtr value) -> bool { ModifierValue modifier_value; - Modifier::icon_t icon = 0; + IconModifier::icon_t icon = 0; ConditionScript trigger { scope_t::PROVINCE, scope_t::NO_SCOPE, scope_t::NO_SCOPE }; bool default_active = false; bool ret = modifier_manager.expect_modifier_value_and_keys( @@ -39,14 +41,18 @@ bool CrimeManager::load_crime_modifiers(ModifierManager const& modifier_manager, return ret; } )(root); + lock_crime_modifiers(); + return ret; } bool CrimeManager::parse_scripts(DefinitionManager const& definition_manager) { bool ret = true; + for (Crime& crime : crime_modifiers.get_items()) { ret &= crime.parse_scripts(definition_manager); } + return ret; } |