diff options
author | hop311 <hop3114@gmail.com> | 2024-01-08 23:19:39 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-01-08 23:19:39 +0100 |
commit | 83802dfead4938e6f98b4b9961b286e06ab78b18 (patch) | |
tree | b0b404a1826d455767b16d3e3ae1d6bf7516e06d /src/openvic-simulation/politics/Rebel.cpp | |
parent | 79b8b73304753fedab822e6aa859fa15673f52cc (diff) |
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.cpp | 15 |
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); } |