aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/politics/Rebel.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-09 11:58:25 +0100
committer GitHub <noreply@github.com>2024-01-09 11:58:25 +0100
commit1d0dc5660040d03fd30168150f951ba98eaaa900 (patch)
treeb0b404a1826d455767b16d3e3ae1d6bf7516e06d /src/openvic-simulation/politics/Rebel.cpp
parent79b8b73304753fedab822e6aa859fa15673f52cc (diff)
parent83802dfead4938e6f98b4b9961b286e06ab78b18 (diff)
Merge pull request #123 from OpenVicProject/map_callback
Added map_callback and expect_item_dictionary_reserve_length
Diffstat (limited to 'src/openvic-simulation/politics/Rebel.cpp')
-rw-r--r--src/openvic-simulation/politics/Rebel.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/openvic-simulation/politics/Rebel.cpp b/src/openvic-simulation/politics/Rebel.cpp
index 6370786..f86bb51 100644
--- a/src/openvic-simulation/politics/Rebel.cpp
+++ b/src/openvic-simulation/politics/Rebel.cpp
@@ -115,17 +115,14 @@ bool RebelManager::load_rebels_file(
"icon", ONE_EXACTLY, expect_uint(assign_variable_callback(icon)),
"area", ONE_EXACTLY, expect_identifier(expect_mapped_string(area_map, assign_variable_callback(area))),
"break_alliance_on_win", ZERO_OR_ONE, expect_bool(assign_variable_callback(break_alliance_on_win)),
- "government", ONE_EXACTLY, government_type_manager.expect_government_type_dictionary(
- [this, &government_type_manager, &desired_governments](GovernmentType const& from,
- ast::NodeCPtr value) -> bool {
- if (desired_governments.contains(&from)) {
- Logger::error("Duplicate \"from\" government type in rebel type: ", from.get_identifier());
- return false;
- }
+ "government", ONE_EXACTLY, government_type_manager.expect_government_type_dictionary_reserve_length(
+ desired_governments,
+ [this, &government_type_manager, &desired_governments](
+ GovernmentType const& from, ast::NodeCPtr value
+ ) -> bool {
return government_type_manager.expect_government_type_identifier(
[&desired_governments, &from](GovernmentType const& to) -> bool {
- desired_governments.emplace(&from, &to);
- return true;
+ return map_callback(desired_governments, &from)(&to);
}
)(value);
}