diff options
author | Hop311 <Hop3114@gmail.com> | 2023-10-15 16:26:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-15 16:26:39 +0200 |
commit | 3249e21104bab6002676abe00450e7bd3f682303 (patch) | |
tree | c2a13a44d4c8553f6e87193f5f437052cf1d7067 /src/openvic-simulation/map | |
parent | 17847e16e14ec52eb48a6fd0d9dc36ee93e457db (diff) | |
parent | d26f9c2fb5a9666822a0f702d76b764600a390d7 (diff) |
Merge pull request #52 from OpenVicProject/tgc-compat
TGC compatibility fixes + other cleanup
Diffstat (limited to 'src/openvic-simulation/map')
-rw-r--r-- | src/openvic-simulation/map/Map.cpp | 8 | ||||
-rw-r--r-- | src/openvic-simulation/map/Province.cpp | 4 | ||||
-rw-r--r-- | src/openvic-simulation/map/Province.hpp | 3 | ||||
-rw-r--r-- | src/openvic-simulation/map/TerrainType.cpp | 15 | ||||
-rw-r--r-- | src/openvic-simulation/map/TerrainType.hpp | 4 |
5 files changed, 21 insertions, 13 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..8624cdb 100644 --- a/src/openvic-simulation/map/TerrainType.cpp +++ b/src/openvic-simulation/map/TerrainType.cpp @@ -5,8 +5,12 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -TerrainType::TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, bool new_is_water) - : HasIdentifierAndColour { new_identifier, new_colour, true, false }, ModifierValue { std::move(new_values) }, is_water { new_is_water } {} +TerrainType::TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_modifier, bool new_is_water) + : HasIdentifierAndColour { new_identifier, new_colour, true, false }, modifier { std::move(new_modifier) }, is_water { new_is_water } {} + +ModifierValue const& TerrainType::get_modifier() const { + return modifier; +} bool TerrainType::get_is_water() const { return is_water; @@ -125,11 +129,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; diff --git a/src/openvic-simulation/map/TerrainType.hpp b/src/openvic-simulation/map/TerrainType.hpp index 1353130..edda0a9 100644 --- a/src/openvic-simulation/map/TerrainType.hpp +++ b/src/openvic-simulation/map/TerrainType.hpp @@ -9,13 +9,15 @@ namespace OpenVic { friend struct TerrainTypeManager; private: + const ModifierValue modifier; const bool is_water; - TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, bool new_is_water); + TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_modifier, bool new_is_water); public: TerrainType(TerrainType&&) = default; + ModifierValue const& get_modifier() const; bool get_is_water() const; }; |