aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Crime.cpp
diff options
context:
space:
mode:
author wvpm <24685035+wvpm@users.noreply.github.com>2024-10-26 18:25:15 +0200
committer GitHub <noreply@github.com>2024-10-26 18:25:15 +0200
commit8d9ff3266439c6a94c35fdf0d8a0642a2cb34de3 (patch)
tree46039d0eb5d630cf000e94aed584aebaaa8f3f9b /src/openvic-simulation/map/Crime.cpp
parentc88cf59997529cbca008f9a2b629822de9deaa2a (diff)
parent3daebe5db14949f55be2c50220323138260dbaea (diff)
Merge pull request #210 from OpenVicProject/contextual_modifier_parsing
Contextual modifier parsing
Diffstat (limited to 'src/openvic-simulation/map/Crime.cpp')
-rw-r--r--src/openvic-simulation/map/Crime.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/openvic-simulation/map/Crime.cpp b/src/openvic-simulation/map/Crime.cpp
index 176f71b..f52352c 100644
--- a/src/openvic-simulation/map/Crime.cpp
+++ b/src/openvic-simulation/map/Crime.cpp
@@ -1,5 +1,6 @@
#include "Crime.hpp"
+#include "openvic-simulation/dataloader/NodeTools.hpp"
#include "openvic-simulation/modifier/ModifierManager.hpp"
using namespace OpenVic;
@@ -29,16 +30,13 @@ 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,
+ bool ret = NodeTools::expect_dictionary_keys_and_default(
+ modifier_manager.expect_base_province_modifier(modifier_value),
"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))