aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/pop')
-rw-r--r--src/openvic-simulation/pop/Culture.cpp20
-rw-r--r--src/openvic-simulation/pop/Religion.cpp8
2 files changed, 5 insertions, 23 deletions
diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp
index dadc0a6..69e1543 100644
--- a/src/openvic-simulation/pop/Culture.cpp
+++ b/src/openvic-simulation/pop/Culture.cpp
@@ -124,22 +124,10 @@ bool CultureManager::_load_culture_group(size_t& total_expected_cultures,
return size;
},
ALLOW_OTHER_KEYS,
- "leader", ONE_EXACTLY, [&total_expected_cultures, &leader](ast::NodeCPtr node) -> bool {
- total_expected_cultures--;
- return expect_identifier(assign_variable_callback(leader))(node);
- },
- "unit", ZERO_OR_ONE, [this, &total_expected_cultures, &unit_graphical_culture_type](ast::NodeCPtr node) -> bool {
- total_expected_cultures--;
- return expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type))(node);
- },
- "union", ZERO_OR_ONE, [&total_expected_cultures](ast::NodeCPtr) -> bool {
- total_expected_cultures--;
- return true;
- },
- "is_overseas", ZERO_OR_ONE, [&total_expected_cultures, &is_overseas](ast::NodeCPtr node) -> bool {
- total_expected_cultures--;
- return expect_bool(assign_variable_callback(is_overseas))(node);
- }
+ "leader", ONE_EXACTLY, decrement_callback(total_expected_cultures, expect_identifier(assign_variable_callback(leader))),
+ "unit", ZERO_OR_ONE, decrement_callback(total_expected_cultures, expect_graphical_culture_type_identifier(assign_variable_callback_pointer(unit_graphical_culture_type))),
+ "union", ZERO_OR_ONE, decrement_callback(total_expected_cultures, success_callback),
+ "is_overseas", ZERO_OR_ONE, decrement_callback(total_expected_cultures, expect_bool(assign_variable_callback(is_overseas)))
)(culture_group_node);
ret &= add_culture_group(culture_group_key, leader, unit_graphical_culture_type, is_overseas);
return ret;
diff --git a/src/openvic-simulation/pop/Religion.cpp b/src/openvic-simulation/pop/Religion.cpp
index ec919fe..acdcad0 100644
--- a/src/openvic-simulation/pop/Religion.cpp
+++ b/src/openvic-simulation/pop/Religion.cpp
@@ -73,13 +73,7 @@ bool ReligionManager::load_religion_file(ast::NodeCPtr root) {
bool ret = expect_dictionary_reserve_length(
religion_groups,
[this, &total_expected_religions](std::string_view key, ast::NodeCPtr value) -> bool {
- bool ret = expect_list_and_length(
- [&total_expected_religions](size_t size) -> size_t {
- total_expected_religions += size;
- return 0;
- },
- success_callback
- )(value);
+ bool ret = expect_length(add_variable_callback(total_expected_religions))(value);
ret &= add_religion_group(key);
return ret;
}