From 3770de7a03879a8ff6b8cf22b402217c19fa2b53 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Mon, 18 Dec 2023 21:41:57 -0500 Subject: Change colour_t to be a strongly typed structure Make RGB default of `colour_t` Distinguish RGB and ARGB colors by type and colour_traits Add `_colour` and `_argb` colour user-defined literals Add `OpenVic::utility::unreachable` --- src/openvic-simulation/map/Map.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/openvic-simulation/map/Map.hpp') diff --git a/src/openvic-simulation/map/Map.hpp b/src/openvic-simulation/map/Map.hpp index 185e99e..9cee86b 100644 --- a/src/openvic-simulation/map/Map.hpp +++ b/src/openvic-simulation/map/Map.hpp @@ -6,8 +6,9 @@ #include #include "openvic-simulation/map/Region.hpp" -#include "openvic-simulation/map/TerrainType.hpp" #include "openvic-simulation/map/State.hpp" +#include "openvic-simulation/map/TerrainType.hpp" +#include "openvic-simulation/types/Colour.hpp" namespace OpenVic { namespace fs = std::filesystem; @@ -17,7 +18,13 @@ namespace OpenVic { /* Bottom 32 bits are the base colour, top 32 are the stripe colour, both in ARGB format with the alpha channels * controlling interpolation with the terrain colour (0 = all terrain, 255 = all corresponding RGB) */ - using base_stripe_t = uint64_t; + struct base_stripe_t { + colour_argb_t base_colour; + colour_argb_t stripe_colour; + constexpr base_stripe_t(colour_argb_t base, colour_argb_t stripe) + : base_colour { base }, stripe_colour { stripe } {} + constexpr base_stripe_t(colour_argb_t both) : base_stripe_t { both, both } {} + }; using colour_func_t = std::function; using index_t = size_t; -- cgit v1.2.3-56-ga3b1