aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Province.hpp
diff options
context:
space:
mode:
author zaaarf <80046572+zaaarf@users.noreply.github.com>2023-09-19 18:08:07 +0200
committer GitHub <noreply@github.com>2023-09-19 18:08:07 +0200
commit7a55877367282749e89ff938ca1d7910f7166fe6 (patch)
tree46ae571e7dddc83ebc7e87ae83726356d0f71934 /src/openvic-simulation/map/Province.hpp
parent9c89100e0c8854dff3174b078d235148585a8b03 (diff)
parent88948eb11127c6d3442fbd476f7b456643b58728 (diff)
Merge pull request #18 from OpenVicProject/province-adjacencies-bis
Basic province adjacencies algorithm/logic
Diffstat (limited to 'src/openvic-simulation/map/Province.hpp')
-rw-r--r--src/openvic-simulation/map/Province.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp
index bf407ae..370d05c 100644
--- a/src/openvic-simulation/map/Province.hpp
+++ b/src/openvic-simulation/map/Province.hpp
@@ -17,6 +17,23 @@ 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:
+ Province const* const province;
+ const distance_t distance;
+ flags_t flags;
+
+ adjacency_t(Province const* province, distance_t distance, flags_t flags);
+
+ public:
+ distance_t get_distance() const;
+ flags_t get_flags();
+ };
static constexpr index_t NULL_INDEX = 0, MAX_INDEX = (1 << (8 * sizeof(index_t))) - 1;
@@ -33,6 +50,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 +84,9 @@ namespace OpenVic {
void update_state(Date const& today);
void tick(Date const& today);
+
+ bool is_adjacent_to(Province const* province);
+ bool add_adjacency(Province const* province, distance_t distance, flags_t flags);
+ std::vector<adjacency_t> const& get_adjacencies() const;
};
}