aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/map/Map.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-12-19 03:41:57 +0100
committer Spartan322 <Megacake1234@gmail.com>2023-12-24 22:57:56 +0100
commit3770de7a03879a8ff6b8cf22b402217c19fa2b53 (patch)
tree0d77d82ab8cea8955e2b86d883d1c2fd10813717 /src/openvic-simulation/map/Map.hpp
parent14e47d58b85f657ec1fed8abf88219f09bd3efbb (diff)
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`
Diffstat (limited to 'src/openvic-simulation/map/Map.hpp')
-rw-r--r--src/openvic-simulation/map/Map.hpp11
1 files changed, 9 insertions, 2 deletions
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 <openvic-dataloader/csv/LineObject.hpp>
#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<base_stripe_t(Map const&, Province const&)>;
using index_t = size_t;