aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Province.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/map/Province.hpp')
-rw-r--r--src/openvic-simulation/map/Province.hpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp
index 67816ff..370d05c 100644
--- a/src/openvic-simulation/map/Province.hpp
+++ b/src/openvic-simulation/map/Province.hpp
@@ -17,13 +17,30 @@ 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;
private:
const index_t index;
Region* region = nullptr;
- bool water = false;
+ bool has_region = false, water = false;
life_rating_t life_rating = 0;
IdentifierRegistry<Building> buildings;
// TODO - change this into a factory-like structure
@@ -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:
@@ -40,8 +59,11 @@ namespace OpenVic {
index_t get_index() const;
Region* get_region() const;
- bool is_water() const;
+ bool get_has_region() const;
+ bool get_water() const;
life_rating_t get_life_rating() const;
+ bool load_positions(BuildingManager const& building_manager, ast::NodeCPtr root);
+
bool add_building(Building&& building);
IDENTIFIER_REGISTRY_ACCESSORS(Building, building)
void reset_buildings();
@@ -62,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;
};
}