aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic2/map/Region.cpp
diff options
context:
space:
mode:
author ClarkeCode <clarke.john.robert@gmail.com>2023-04-27 22:13:52 +0200
committer ClarkeCode <clarke.john.robert@gmail.com>2023-04-27 22:13:52 +0200
commit0b273743b480874281a8987c72b2f1b666bc289a (patch)
tree3f5d5a6316ac66407e61c8a56fe732cdf06209e5 /extension/src/openvic2/map/Region.cpp
parent98dd680a641a2cbe0f1f93202a5beffdfd35c9f7 (diff)
parent10053cf259c55ee45803268a844edf1011d8a16b (diff)
Merge branch 'main' of github.com:OpenVic2Project/OpenVic2 into goods
Diffstat (limited to 'extension/src/openvic2/map/Region.cpp')
-rw-r--r--extension/src/openvic2/map/Region.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/extension/src/openvic2/map/Region.cpp b/extension/src/openvic2/map/Region.cpp
new file mode 100644
index 0000000..3e5bee7
--- /dev/null
+++ b/extension/src/openvic2/map/Region.cpp
@@ -0,0 +1,26 @@
+#include "openvic2/map/Region.hpp"
+
+#include <cassert>
+#include <algorithm>
+
+using namespace OpenVic2;
+
+size_t ProvinceSet::get_province_count() const {
+ return provinces.size();
+}
+
+bool ProvinceSet::contains_province(Province const* province) const {
+ return province && std::find(provinces.begin(), provinces.end(), province) != provinces.end();
+}
+
+std::set<Province*> const& ProvinceSet::get_provinces() const {
+ return provinces;
+}
+
+Region::Region(std::string const& new_identifier) : HasIdentifier{ new_identifier } {}
+
+Province::colour_t Region::get_colour() const {
+ if (provinces.empty()) return 0xFF0000;
+ Province const* province = *provinces.cbegin();
+ return province->get_colour();
+}