aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Region.hpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-09-08 18:12:22 +0200
committer Hop311 <hop3114@gmail.com>2023-09-08 18:12:22 +0200
commit7772f8871348b7b52cb0a478bb76df68d8799a07 (patch)
treefd8c4626b2cee69a9fe9250365af6b18eea63c70 /src/openvic-simulation/map/Region.hpp
parent7f9a9a8241ba81be9213e6606b8be4a48f1cbaab (diff)
More refactoring and duplicate code removal
Diffstat (limited to 'src/openvic-simulation/map/Region.hpp')
-rw-r--r--src/openvic-simulation/map/Region.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/openvic-simulation/map/Region.hpp b/src/openvic-simulation/map/Region.hpp
new file mode 100644
index 0000000..2fccf06
--- /dev/null
+++ b/src/openvic-simulation/map/Region.hpp
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "openvic-simulation/map/Province.hpp"
+
+namespace OpenVic {
+
+ struct ProvinceSet {
+ protected:
+ std::vector<Province*> provinces;
+ bool locked = false;
+
+ public:
+ bool add_province(Province* province);
+ void lock(bool log = false);
+ bool is_locked() const;
+ void reset();
+ bool empty() const;
+ size_t size() const;
+ void reserve(size_t size);
+ bool contains_province(Province const* province) const;
+ std::vector<Province*> const& get_provinces() const;
+ };
+
+ /* REQUIREMENTS:
+ * MAP-6, MAP-44, MAP-48
+ */
+ struct Region : HasIdentifier, ProvinceSet {
+ friend struct Map;
+
+ private:
+ Region(const std::string_view new_identifier);
+
+ public:
+ Region(Region&&) = default;
+
+ colour_t get_colour() const;
+ };
+}