aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/MapDefinition.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-09-21 18:47:22 +0200
committer GitHub <noreply@github.com>2024-09-21 18:47:22 +0200
commit7e895eaea194e266b112cb507b0d643083f2ad4b (patch)
tree0b63109a3b044363cd92e0388994604b013b49f2 /src/openvic-simulation/map/MapDefinition.hpp
parent4b69a91a6db50f86efec503b56b07573c692df9f (diff)
parentbe284699453b2ee629725fa5cc2f84a2ca7684a2 (diff)
Merge pull request #196 from OpenVicProject/riverstopbar-tech
Simulation Side Rivers
Diffstat (limited to 'src/openvic-simulation/map/MapDefinition.hpp')
-rw-r--r--src/openvic-simulation/map/MapDefinition.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/openvic-simulation/map/MapDefinition.hpp b/src/openvic-simulation/map/MapDefinition.hpp
index 9ec4367..e835da8 100644
--- a/src/openvic-simulation/map/MapDefinition.hpp
+++ b/src/openvic-simulation/map/MapDefinition.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <cstdint>
#include <filesystem>
#include <string_view>
#include <vector>
@@ -20,6 +21,19 @@ namespace OpenVic {
struct BuildingTypeManager;
struct ModifierManager;
+ struct RiverSegment {
+ friend struct MapDefinition;
+
+ private:
+ const uint8_t PROPERTY(size);
+ std::vector<ivec2_t> PROPERTY(points);
+
+ RiverSegment(uint8_t new_size, std::vector<ivec2_t>&& new_points);
+
+ public:
+ RiverSegment(RiverSegment&&) = default;
+ };
+
/* REQUIREMENTS:
* MAP-4
*/
@@ -35,6 +49,7 @@ namespace OpenVic {
private:
using colour_index_map_t = ordered_map<colour_t, ProvinceDefinition::index_t>;
+ using river_t = std::vector<RiverSegment>;
IdentifierRegistry<ProvinceDefinition> IDENTIFIER_REGISTRY_CUSTOM_INDEX_OFFSET(province_definition, 1);
IdentifierRegistry<Region> IDENTIFIER_REGISTRY(region);
@@ -43,6 +58,7 @@ namespace OpenVic {
ProvinceSet water_provinces;
TerrainTypeManager PROPERTY_REF(terrain_type_manager);
+ std::vector<river_t> PROPERTY(rivers); // TODO: calculate provinces affected by crossing
ivec2_t PROPERTY(dims);
std::vector<shape_pixel_t> PROPERTY(province_shape_image);
colour_index_map_t colour_index_map;
@@ -104,7 +120,7 @@ namespace OpenVic {
bool load_province_positions(BuildingTypeManager const& building_type_manager, ast::NodeCPtr root);
static bool load_region_colours(ast::NodeCPtr root, std::vector<colour_t>& colours);
bool load_region_file(ast::NodeCPtr root, std::vector<colour_t> const& colours);
- bool load_map_images(fs::path const& province_path, fs::path const& terrain_path, bool detailed_errors);
+ bool load_map_images(fs::path const& province_path, fs::path const& terrain_path, fs::path const& rivers_path, bool detailed_errors);
bool generate_and_load_province_adjacencies(std::vector<ovdl::csv::LineObject> const& additional_adjacencies);
bool load_climate_file(ModifierManager const& modifier_manager, ast::NodeCPtr root);
bool load_continent_file(ModifierManager const& modifier_manager, ast::NodeCPtr root);