aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Crime.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
committer hop311 <hop3114@gmail.com>2024-10-19 12:39:08 +0200
commit572ac597d8b43c4c97be4b68aa40de0e7ae6bfe0 (patch)
treec529d60fe49fbcd167522c0fb21ca10139cb5cc7 /src/openvic-simulation/map/Crime.cpp
parent35909d6e79d524f19f9b69dffd02fcf162be5093 (diff)
Require modifier type when parsing ModifierValues
Diffstat (limited to 'src/openvic-simulation/map/Crime.cpp')
-rw-r--r--src/openvic-simulation/map/Crime.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/Crime.cpp b/src/openvic-simulation/map/Crime.cpp
index 532be9d..176f71b 100644
--- a/src/openvic-simulation/map/Crime.cpp
+++ b/src/openvic-simulation/map/Crime.cpp
@@ -29,17 +29,23 @@ bool CrimeManager::load_crime_modifiers(ModifierManager const& modifier_manager,
const bool ret = expect_dictionary_reserve_length(
crime_modifiers,
[this, &modifier_manager](std::string_view key, ast::NodeCPtr value) -> bool {
+ using enum Modifier::modifier_type_t;
+
ModifierValue modifier_value;
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(
move_variable_callback(modifier_value),
+ CRIME,
"icon", ZERO_OR_ONE, expect_uint(assign_variable_callback(icon)),
"trigger", ONE_EXACTLY, trigger.expect_script(),
"active", ZERO_OR_ONE, expect_bool(assign_variable_callback(default_active))
)(value);
+
ret &= add_crime_modifier(key, std::move(modifier_value), icon, std::move(trigger), default_active);
+
return ret;
}
)(root);