aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-10-13 18:34:25 +0200
committer hop311 <hop3114@gmail.com>2023-10-13 19:14:01 +0200
commitce6e70d079f4ab18cdfa082032dc3580ab233b0e (patch)
tree0e2d1e13c35c0ea97acc5474c41adb69207277d4 /src/openvic-simulation/map
parent17847e16e14ec52eb48a6fd0d9dc36ee93e457db (diff)
TGC compatibility fixes + other cleanup
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r--src/openvic-simulation/map/Map.cpp8
-rw-r--r--src/openvic-simulation/map/Province.cpp4
-rw-r--r--src/openvic-simulation/map/Province.hpp3
-rw-r--r--src/openvic-simulation/map/TerrainType.cpp7
4 files changed, 12 insertions, 10 deletions
diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp
index acd882e..777579e 100644
--- a/src/openvic-simulation/map/Map.cpp
+++ b/src/openvic-simulation/map/Map.cpp
@@ -525,16 +525,16 @@ bool Map::load_map_images(fs::path const& province_path, fs::path const& terrain
for (size_t idx = 0; idx < province_checklist.size(); ++idx) {
Province* province = provinces.get_item_by_index(idx);
province->_set_terrain_type(reinterpret_cast<TerrainType const*>(get_largest_item(terrain_type_pixels_list[idx]).first));
- if (!province_checklist[idx]) {
+ province->on_map = province_checklist[idx];
+ if (!province->on_map) {
if (detailed_errors) {
- Logger::error("Province missing from shape image: ", province->to_string());
+ Logger::warning("Province missing from shape image: ", province->to_string());
}
missing++;
}
}
if (missing > 0) {
- Logger::error("Province image is missing ", missing, " province colours");
- ret = false;
+ Logger::warning("Province image is missing ", missing, " province colours");
}
return ret;
diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp
index 5b1a130..45b3987 100644
--- a/src/openvic-simulation/map/Province.cpp
+++ b/src/openvic-simulation/map/Province.cpp
@@ -17,6 +17,10 @@ Region* Province::get_region() const {
return region;
}
+bool Province::get_on_map() const {
+ return on_map;
+}
+
bool Province::get_has_region() const {
return has_region;
}
diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp
index d925898..2704354 100644
--- a/src/openvic-simulation/map/Province.hpp
+++ b/src/openvic-simulation/map/Province.hpp
@@ -61,7 +61,7 @@ namespace OpenVic {
private:
const index_t index;
Region* region = nullptr;
- bool has_region = false, water = false;
+ bool on_map = false, has_region = false, water = false;
life_rating_t life_rating = 0;
IdentifierRegistry<BuildingInstance> buildings;
// TODO - change this into a factory-like structure
@@ -85,6 +85,7 @@ namespace OpenVic {
index_t get_index() const;
Region* get_region() const;
+ bool get_on_map() const;
bool get_has_region() const;
bool get_water() const;
TerrainType const* get_terrain_type() const;
diff --git a/src/openvic-simulation/map/TerrainType.cpp b/src/openvic-simulation/map/TerrainType.cpp
index ce0b7e7..017b220 100644
--- a/src/openvic-simulation/map/TerrainType.cpp
+++ b/src/openvic-simulation/map/TerrainType.cpp
@@ -125,11 +125,8 @@ bool TerrainTypeManager::_load_terrain_type_mapping(std::string_view mapping_key
"priority", ZERO_OR_ONE, expect_uint(assign_variable_callback(priority)),
"has_texture", ZERO_OR_ONE, expect_bool(assign_variable_callback(has_texture))
)(mapping_value);
- if (has_texture) {
- if (++terrain_texture_count == terrain_texture_limit + 1) {
- Logger::error("More terrain textures than limit!");
- ret = false;
- }
+ if (has_texture && ++terrain_texture_count == terrain_texture_limit + 1) {
+ Logger::warning("More terrain textures than limit!");
}
ret &= add_terrain_type_mapping(mapping_key, type, std::move(terrain_indicies), priority, has_texture);
return true;