aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic2/Map.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/openvic2/Map.hpp')
-rw-r--r--extension/src/openvic2/Map.hpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/extension/src/openvic2/Map.hpp b/extension/src/openvic2/Map.hpp
index 423b427..1527f1a 100644
--- a/extension/src/openvic2/Map.hpp
+++ b/extension/src/openvic2/Map.hpp
@@ -6,6 +6,8 @@
namespace OpenVic2 {
+ struct Region;
+
struct Province {
using colour_t = uint32_t;
using index_t = uint16_t;
@@ -16,6 +18,7 @@ namespace OpenVic2 {
index_t index;
std::string identifier;
colour_t colour;
+ Region* region = nullptr;
Province(index_t new_index, std::string const& new_identifier, colour_t new_colour);
public:
@@ -24,17 +27,35 @@ namespace OpenVic2 {
index_t get_index() const;
std::string const& get_identifier() const;
colour_t get_colour() const;
+ Region* get_region() const;
std::string to_string() const;
};
+ struct Region {
+ friend struct Map;
+ private:
+ std::string identifier;
+ std::vector<Province*> provinces;
+
+ Region(std::string const& new_identifier);
+ public:
+ std::string const& get_identifier() const;
+ size_t get_province_count() const;
+ bool contains_province(Province const* province) const;
+ std::vector<Province*> const& get_provinces() const;
+ };
+
struct Map {
private:
std::vector<Province> provinces;
- bool provinces_locked = false;
+ std::vector<Region> regions;
+ bool provinces_locked = false, regions_locked = false;
public:
bool add_province(std::string const& identifier, Province::colour_t colour, std::string& error_message);
void lock_provinces();
+ bool add_region(std::string const& identifier, std::vector<std::string> const& province_identifiers, std::string& error_message);
+ void lock_regions();
size_t get_province_count() const;
Province* get_province_by_index(Province::index_t index);