From 46bbbb038e5fa21e25fa33c4fee84e4b14690885 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Thu, 14 Sep 2023 20:09:10 +0100 Subject: Meta region loading --- src/openvic-simulation/map/Region.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/openvic-simulation/map/Region.cpp') diff --git a/src/openvic-simulation/map/Region.cpp b/src/openvic-simulation/map/Region.cpp index 33092c5..c0422de 100644 --- a/src/openvic-simulation/map/Region.cpp +++ b/src/openvic-simulation/map/Region.cpp @@ -2,6 +2,8 @@ using namespace OpenVic; +ProvinceSet::ProvinceSet(provinces_t&& new_provinces) : provinces { std::move(new_provinces) } {} + bool ProvinceSet::add_province(Province* province) { if (locked) { Logger::error("Cannot add province to province set - locked!"); @@ -57,13 +59,20 @@ 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 { +ProvinceSet::provinces_t const& ProvinceSet::get_provinces() const { return provinces; } -Region::Region(const std::string_view new_identifier) : HasIdentifier { new_identifier } {} +Region::Region(const std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta) + : HasIdentifier { new_identifier }, ProvinceSet { std::move(new_provinces) }, meta { new_meta } { + lock(); +} + +bool Region::get_meta() const { + return meta; +} colour_t Region::get_colour() const { - if (provinces.empty()) return FULL_COLOUR << 16; - return provinces.front()->get_colour(); + if (empty()) return FULL_COLOUR << 16; + return get_provinces().front()->get_colour(); } -- cgit v1.2.3-56-ga3b1