From 42d9d1d5417deb5979a9d5775cfe97dcff4b77ba Mon Sep 17 00:00:00 2001 From: Hop311 Date: Tue, 16 May 2023 19:59:39 +0100 Subject: Changed from OpenVic2 to OpenVic --- src/openvic/map/Region.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/openvic/map/Region.cpp (limited to 'src/openvic/map/Region.cpp') diff --git a/src/openvic/map/Region.cpp b/src/openvic/map/Region.cpp new file mode 100644 index 0000000..d546ff9 --- /dev/null +++ b/src/openvic/map/Region.cpp @@ -0,0 +1,24 @@ +#include "Region.hpp" + +#include + +using namespace OpenVic; + +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::vector const& ProvinceSet::get_provinces() const { + return provinces; +} + +Region::Region(std::string const& new_identifier) : HasIdentifier{ new_identifier } {} + +colour_t Region::get_colour() const { + if (provinces.empty()) return FULL_COLOUR << 16; + return provinces.front()->get_colour(); +} -- cgit v1.2.3-56-ga3b1