From 00a3121dd43a3b6e8f5a6efa2d3b6560ef78c370 Mon Sep 17 00:00:00 2001 From: hop311 Date: Wed, 18 Sep 2024 23:26:37 +0100 Subject: Allow Issue to inherit Modifier directly --- src/openvic-simulation/politics/Issue.cpp | 4 ++-- src/openvic-simulation/politics/Issue.hpp | 2 +- src/openvic-simulation/types/HasIdentifier.hpp | 3 +++ src/openvic-simulation/types/IndexedMap.hpp | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/openvic-simulation/politics/Issue.cpp b/src/openvic-simulation/politics/Issue.cpp index 1dca176..4a08dea 100644 --- a/src/openvic-simulation/politics/Issue.cpp +++ b/src/openvic-simulation/politics/Issue.cpp @@ -8,8 +8,8 @@ IssueGroup::IssueGroup(std::string_view new_identifier) : HasIdentifier { new_id Issue::Issue( std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, IssueGroup const& new_group, RuleSet&& new_rules, bool new_jingoism -) : HasIdentifierAndColour { new_identifier, new_colour, false }, ModifierValue { std::move(new_values) }, - group { new_group }, rules { std::move(new_rules) }, jingoism { new_jingoism } {} +) : Modifier { new_identifier, std::move(new_values) }, HasColour { new_colour, false }, group { new_group }, + rules { std::move(new_rules) }, jingoism { new_jingoism } {} ReformType::ReformType(std::string_view new_identifier, bool new_uncivilised) : HasIdentifier { new_identifier }, uncivilised { new_uncivilised } {} diff --git a/src/openvic-simulation/politics/Issue.hpp b/src/openvic-simulation/politics/Issue.hpp index d49f897..3a6daed 100644 --- a/src/openvic-simulation/politics/Issue.hpp +++ b/src/openvic-simulation/politics/Issue.hpp @@ -21,7 +21,7 @@ namespace OpenVic { }; // Issue (i.e. protectionism) - struct Issue : HasIdentifierAndColour, ModifierValue { + struct Issue : Modifier, HasColour { friend struct IssueManager; private: diff --git a/src/openvic-simulation/types/HasIdentifier.hpp b/src/openvic-simulation/types/HasIdentifier.hpp index 74961e3..bbd9771 100644 --- a/src/openvic-simulation/types/HasIdentifier.hpp +++ b/src/openvic-simulation/types/HasIdentifier.hpp @@ -102,6 +102,9 @@ namespace OpenVic { using HasIdentifierAndColour = _HasIdentifierAndColour; using HasIdentifierAndAlphaColour = _HasIdentifierAndColour; + template + concept HasGetIdentifierAndGetColour = HasGetIdentifier && HasGetColour; + template class HasIndex { public: diff --git a/src/openvic-simulation/types/IndexedMap.hpp b/src/openvic-simulation/types/IndexedMap.hpp index 5682c0e..73ff313 100644 --- a/src/openvic-simulation/types/IndexedMap.hpp +++ b/src/openvic-simulation/types/IndexedMap.hpp @@ -18,6 +18,8 @@ namespace OpenVic { using value_const_ref_t = container_t::const_reference; using keys_t = std::vector; + using key_type = key_t; // To match tsl::ordered_map's key_type + using container_t::operator[]; using container_t::size; using container_t::begin; -- cgit v1.2.3-56-ga3b1