aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Map.cpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-11-04 19:44:38 +0100
committer hop311 <hop3114@gmail.com>2023-11-07 19:34:51 +0100
commitb5bbeb47febc823517a5baba4eca66f32fb3609c (patch)
tree1a78d296f22d1cd17a84ce824974f9438a197074 /src/openvic-simulation/map/Map.cpp
parentc1b7cab254ac14a173477661047ad2492930ff8b (diff)
Cross-platform file lookup (case and separator)
Diffstat (limited to 'src/openvic-simulation/map/Map.cpp')
-rw-r--r--src/openvic-simulation/map/Map.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp
index b1aea2c..7e2213e 100644
--- a/src/openvic-simulation/map/Map.cpp
+++ b/src/openvic-simulation/map/Map.cpp
@@ -42,6 +42,12 @@ bool Map::add_province(std::string_view identifier, colour_t colour) {
Logger::error("Invalid province identifier - empty!");
return false;
}
+ if (!valid_basic_identifier(identifier)) {
+ Logger::error(
+ "Invalid province identifier: ", identifier, " (can only contain alphanumeric characters and underscores)"
+ );
+ return false;
+ }
if (colour == NULL_COLOUR || colour > MAX_COLOUR_RGB) {
Logger::error("Invalid province colour for ", identifier, ": ", colour_to_hex_string(colour));
return false;
@@ -483,7 +489,7 @@ bool Map::load_map_images(fs::path const& province_path, fs::path const& terrain
uint8_t const* terrain_data = terrain_bmp.get_pixel_data().data();
std::vector<bool> province_checklist(provinces.size());
- std::vector<distribution_t> terrain_type_pixels_list(provinces.size());
+ std::vector<decimal_map_t<TerrainType const*>> terrain_type_pixels_list(provinces.size());
bool ret = true;
std::unordered_set<colour_t> unrecognised_province_colours;