aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-09-09 16:00:23 +0200
committer Hop311 <hop3114@gmail.com>2023-09-09 22:50:29 +0200
commitb4220ad73e14e3b497b2fdeb83d76a6633664764 (patch)
tree72aee7b62ca2a1714799ff8f477ca1e50407eca8 /src/openvic-simulation/map
parent7772f8871348b7b52cb0a478bb76df68d8799a07 (diff)
PR feedback + Logger::warning
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r--src/openvic-simulation/map/Map.cpp14
-rw-r--r--src/openvic-simulation/map/Province.cpp6
2 files changed, 9 insertions, 11 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp
index 3f86ccc..8f10410 100644
--- a/src/openvic-simulation/map/Map.cpp
+++ b/src/openvic-simulation/map/Map.cpp
@@ -68,8 +68,8 @@ bool Map::set_water_province(const std::string_view identifier) {
return false;
}
if (province->is_water()) {
- Logger::error("Province ", identifier, " is already a water province!");
- return false;
+ Logger::warning("Province ", identifier, " is already a water province!");
+ return true;
}
if (!water_provinces.add_province(province)) {
Logger::error("Failed to add province ", identifier, " to water province set!");
@@ -278,7 +278,7 @@ bool Map::generate_province_shape_image(size_t new_width, size_t new_height, uin
if (unrecognised_terrain_colours.find(terrain_colour) == unrecognised_terrain_colours.end()) {
unrecognised_terrain_colours.insert(terrain_colour);
if (detailed_errors) {
- Logger::error("Unrecognised terrain colour ", colour_to_hex_string(terrain_colour),
+ Logger::warning("Unrecognised terrain colour ", colour_to_hex_string(terrain_colour),
" at (", x, ", ", y, ")");
}
}
@@ -309,7 +309,7 @@ bool Map::generate_province_shape_image(size_t new_width, size_t new_height, uin
if (unrecognised_province_colours.find(province_colour) == unrecognised_province_colours.end()) {
unrecognised_province_colours.insert(province_colour);
if (detailed_errors) {
- Logger::error("Unrecognised province colour ", colour_to_hex_string(province_colour),
+ Logger::warning("Unrecognised province colour ", colour_to_hex_string(province_colour),
" at (", x, ", ", y, ")");
}
}
@@ -317,12 +317,10 @@ bool Map::generate_province_shape_image(size_t new_width, size_t new_height, uin
}
}
if (!unrecognised_province_colours.empty()) {
- Logger::error("Province image contains ", unrecognised_province_colours.size(), " unrecognised province colours");
- ret = false;
+ Logger::warning("Province image contains ", unrecognised_province_colours.size(), " unrecognised province colours");
}
if (!unrecognised_terrain_colours.empty()) {
- Logger::error("Terrain image contains ", unrecognised_terrain_colours.size(), " unrecognised terrain colours");
- ret = false;
+ Logger::warning("Terrain image contains ", unrecognised_terrain_colours.size(), " unrecognised terrain colours");
}
size_t missing = 0;
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp
index 43eddd1..8d4abcb 100644
--- a/src/openvic-simulation/map/Province.cpp
+++ b/src/openvic-simulation/map/Province.cpp
@@ -55,10 +55,10 @@ std::string Province::to_string() const {
}
bool Province::load_pop_list(PopManager const& pop_manager, ast::NodeCPtr root) {
- return expect_list_reserve_length(
+ return expect_dictionary_reserve_length(
pops,
- [this, &pop_manager](ast::NodeCPtr pop_node) -> bool {
- return pop_manager.load_pop_into_province(*this, pop_node);
+ [this, &pop_manager](std::string_view pop_type_identifier, ast::NodeCPtr pop_node) -> bool {
+ return pop_manager.load_pop_into_province(*this, pop_type_identifier, pop_node);
}
)(root);
}