diff options
author | Hop311 <Hop3114@gmail.com> | 2023-11-17 10:19:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-17 10:19:53 +0100 |
commit | e76336cd92639f4ec71088fc4c80aea4c25528cd (patch) | |
tree | eeed419a7d97ecb58adf63a17eb9184db3e5ed7a /src/openvic-simulation/map/Region.cpp | |
parent | a00b558a53edb40c9e6789790036f0b618e80ec1 (diff) | |
parent | 886b8b8f396438fc2b7da7d2508f2064d14150a8 (diff) |
Merge pull request #75 from OpenVicProject/accumulated-changes
Accumulated changes
Diffstat (limited to 'src/openvic-simulation/map/Region.cpp')
-rw-r--r-- | src/openvic-simulation/map/Region.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/openvic-simulation/map/Region.cpp b/src/openvic-simulation/map/Region.cpp index ac232df..e33d9c9 100644 --- a/src/openvic-simulation/map/Region.cpp +++ b/src/openvic-simulation/map/Region.cpp @@ -65,18 +65,15 @@ ProvinceSet::provinces_t const& ProvinceSet::get_provinces() const { return provinces; } +static constexpr colour_t ERROR_REGION_COLOUR = COLOUR_COMPONENT << 16; + Region::Region(std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta) - : HasIdentifier { new_identifier }, ProvinceSet { std::move(new_provinces) }, meta { new_meta } { + : HasIdentifierAndColour { + new_identifier, new_provinces.size() > 0 ? new_provinces.front()->get_colour() : ERROR_REGION_COLOUR, false, false + }, ProvinceSet { std::move(new_provinces) }, meta { new_meta } { lock(); } bool Region::get_meta() const { return meta; } - -colour_t Region::get_colour() const { - if (empty()) { - return FULL_COLOUR << 16; - } - return get_provinces().front()->get_colour(); -} |