aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Province.hpp
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-09-18 18:35:13 +0200
committer zaaarf <zaaarf@proton.me>2023-09-19 17:32:57 +0200
commitade93c528bca7321393a767a4a379a0ebae3d215 (patch)
treebfa1d072273dbd257732c8ee13a68bf00bbe4322 /src/openvic-simulation/map/Province.hpp
parent72add97c47f0d17fc0019bb4cfec7506740a9c7d (diff)
feat: added adjacency to provinces
Diffstat (limited to 'src/openvic-simulation/map/Province.hpp')
-rw-r--r--src/openvic-simulation/map/Province.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp
index bf407ae..4c89db4 100644
--- a/src/openvic-simulation/map/Province.hpp
+++ b/src/openvic-simulation/map/Province.hpp
@@ -17,6 +17,19 @@ namespace OpenVic {
using index_t = uint16_t;
using life_rating_t = int8_t;
+ using distance_t = uint16_t;
+ using flags_t = uint16_t;
+
+ struct adjacency_t {
+ friend struct Province;
+
+ private:
+ index_t province_id;
+ distance_t distance;
+ flags_t flags;
+
+ adjacency_t(index_t provice_id, distance_t distance, flags_t flags);
+ };
static constexpr index_t NULL_INDEX = 0, MAX_INDEX = (1 << (8 * sizeof(index_t))) - 1;
@@ -33,6 +46,8 @@ namespace OpenVic {
Pop::pop_size_t total_population;
distribution_t pop_types, cultures, religions;
+ std::vector<adjacency_t> adjacencies;
+
Province(const std::string_view new_identifier, colour_t new_colour, index_t new_index);
public:
@@ -65,5 +80,9 @@ namespace OpenVic {
void update_state(Date const& today);
void tick(Date const& today);
+
+ bool is_adjacent_to(index_t province_index);
+ bool add_adjacency(index_t province_index, distance_t distance, flags_t flags);
+ std::vector<adjacency_t> const& get_adjacencies() const;
};
}