aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/pop/Religion.cpp
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/pop/Religion.cpp
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/pop/Religion.cpp')
-rw-r--r--src/openvic-simulation/pop/Religion.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/openvic-simulation/pop/Religion.cpp b/src/openvic-simulation/pop/Religion.cpp
index a5e9faf..0527da7 100644
--- a/src/openvic-simulation/pop/Religion.cpp
+++ b/src/openvic-simulation/pop/Religion.cpp
@@ -2,6 +2,8 @@
#include <cassert>
+#include "openvic-simulation/types/Colour.hpp"
+
using namespace OpenVic;
using namespace OpenVic::NodeTools;
@@ -9,8 +11,7 @@ ReligionGroup::ReligionGroup(std::string_view new_identifier) : HasIdentifier {
Religion::Religion(
std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon, bool new_pagan
-) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, group { new_group }, icon { new_icon },
- pagan { new_pagan } {
+) : HasIdentifierAndColour { new_identifier, new_colour, false }, group { new_group }, icon { new_icon }, pagan { new_pagan } {
assert(icon > 0);
}
@@ -33,10 +34,6 @@ bool ReligionManager::add_religion(
Logger::error("Invalid religion identifier - empty!");
return false;
}
- if (colour > MAX_COLOUR_RGB) {
- Logger::error("Invalid religion colour for ", identifier, ": ", colour_to_hex_string(colour));
- return false;
- }
if (icon <= 0) {
Logger::error("Invalid religion icon for ", identifier, ": ", icon);
return false;
@@ -61,7 +58,7 @@ bool ReligionManager::load_religion_file(ast::NodeCPtr root) {
religions.reserve(religions.size() + total_expected_religions);
ret &= expect_religion_group_dictionary([this](ReligionGroup const& religion_group, ast::NodeCPtr religion_group_value) -> bool {
return expect_dictionary([this, &religion_group](std::string_view key, ast::NodeCPtr value) -> bool {
- colour_t colour = NULL_COLOUR;
+ colour_t colour = colour_t::null();
Religion::icon_t icon = 0;
bool pagan = false;