aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2024-01-08 23:19:39 +0100
committer hop311 <hop3114@gmail.com>2024-01-08 23:19:39 +0100
commit83802dfead4938e6f98b4b9961b286e06ab78b18 (patch)
treeb0b404a1826d455767b16d3e3ae1d6bf7516e06d /src/openvic-simulation/map
parent79b8b73304753fedab822e6aa859fa15673f52cc (diff)
Added map_callback and expect_item_dictionary_reserve_length
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r--src/openvic-simulation/map/Map.cpp2
-rw-r--r--src/openvic-simulation/map/Province.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp
index 27079f4..1415e2c 100644
--- a/src/openvic-simulation/map/Map.cpp
+++ b/src/openvic-simulation/map/Map.cpp
@@ -893,6 +893,8 @@ bool Map::load_continent_file(ModifierManager const& modifier_manager, ast::Node
[&prov_list](Province const& province) -> bool {
if (province.continent == nullptr) {
prov_list.emplace_back(&province);
+ } else {
+ Logger::warning("Province ", province, " found in multiple continents");
}
return true;
}
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp
index 1c3c76f..acabbf8 100644
--- a/src/openvic-simulation/map/Province.cpp
+++ b/src/openvic-simulation/map/Province.cpp
@@ -36,12 +36,10 @@ bool Province::load_positions(BuildingTypeManager const& building_type_manager,
"factory", ZERO_OR_ONE, expect_fvec2(assign_variable_callback(positions.factory)),
"building_construction", ZERO_OR_ONE, expect_fvec2(assign_variable_callback(positions.building_construction)),
"military_construction", ZERO_OR_ONE, expect_fvec2(assign_variable_callback(positions.military_construction)),
- "building_position", ZERO_OR_ONE, building_type_manager.expect_building_type_dictionary(
+ "building_position", ZERO_OR_ONE, building_type_manager.expect_building_type_dictionary_reserve_length(
+ positions.building_position,
[this](BuildingType const& type, ast::NodeCPtr value) -> bool {
- return expect_fvec2([this, &type](fvec2_t position) -> bool {
- positions.building_position.emplace(&type, std::move(position));
- return true;
- })(value);
+ return expect_fvec2(map_callback(positions.building_position, &type))(value);
}
),
"building_rotation", ZERO_OR_ONE, building_type_manager.expect_building_type_decimal_map(