From 721577e1210c8e9a526b69c77b0bddb098fd5d1e Mon Sep 17 00:00:00 2001 From: hop311 Date: Mon, 18 Mar 2024 19:30:27 +0000 Subject: Add Issue/Reform/Party colours + improve loading --- src/openvic-simulation/country/Country.cpp | 20 ++++++++++---------- src/openvic-simulation/country/Country.hpp | 22 +++++++--------------- 2 files changed, 17 insertions(+), 25 deletions(-) (limited to 'src/openvic-simulation/country') diff --git a/src/openvic-simulation/country/Country.cpp b/src/openvic-simulation/country/Country.cpp index 604e11f..5ec4aee 100644 --- a/src/openvic-simulation/country/Country.cpp +++ b/src/openvic-simulation/country/Country.cpp @@ -20,36 +20,36 @@ using namespace OpenVic::NodeTools; CountryParty::CountryParty( std::string_view new_identifier, Date new_start_date, Date new_end_date, Ideology const& new_ideology, policy_map_t&& new_policies -) : HasIdentifier { new_identifier }, start_date { new_start_date }, end_date { new_end_date }, ideology { new_ideology }, - policies { std::move(new_policies) } {} +) : HasIdentifierAndColour { new_identifier, new_ideology.get_colour(), false }, start_date { new_start_date }, + end_date { new_end_date }, ideology { new_ideology }, policies { std::move(new_policies) } {} Country::Country( std::string_view new_identifier, colour_t new_colour, GraphicalCultureType const& new_graphical_culture, - IdentifierRegistry&& new_parties, - unit_names_map_t&& new_unit_names, + IdentifierRegistry&& new_parties, + unit_names_map_t&& new_unit_names, bool new_dynamic_tag, government_colour_map_t&& new_alternative_colours, colour_t new_primary_unit_colour, colour_t new_secondary_unit_colour, colour_t new_tertiary_unit_colour -) : HasIdentifierAndColour { - new_identifier, new_colour, false }, +) : HasIdentifierAndColour { + new_identifier, new_colour, false }, graphical_culture { new_graphical_culture }, - parties { std::move(new_parties) }, - unit_names { std::move(new_unit_names) }, + parties { std::move(new_parties) }, + unit_names { std::move(new_unit_names) }, dynamic_tag { new_dynamic_tag }, alternative_colours { std::move(new_alternative_colours) }, primary_unit_colour { new_primary_unit_colour }, secondary_unit_colour { new_secondary_unit_colour }, - tertiary_unit_colour { new_tertiary_unit_colour } + tertiary_unit_colour { new_tertiary_unit_colour } {} bool CountryManager::add_country( std::string_view identifier, colour_t colour, GraphicalCultureType const* graphical_culture, IdentifierRegistry&& parties, Country::unit_names_map_t&& unit_names, bool dynamic_tag, - Country::government_colour_map_t&& alternative_colours, + Country::government_colour_map_t&& alternative_colours, colour_t primary_unit_colour, colour_t secondary_unit_colour, colour_t tertiary_unit_colour ) { if (identifier.empty()) { diff --git a/src/openvic-simulation/country/Country.hpp b/src/openvic-simulation/country/Country.hpp index f115489..ea8f732 100644 --- a/src/openvic-simulation/country/Country.hpp +++ b/src/openvic-simulation/country/Country.hpp @@ -1,11 +1,6 @@ #pragma once -#include -#include -#include #include -#include -#include #include @@ -14,10 +9,8 @@ #include "openvic-simulation/politics/Government.hpp" #include "openvic-simulation/politics/Ideology.hpp" #include "openvic-simulation/politics/Issue.hpp" -#include "openvic-simulation/politics/NationalValue.hpp" #include "openvic-simulation/politics/PoliticsManager.hpp" #include "openvic-simulation/pop/Culture.hpp" -#include "openvic-simulation/pop/Religion.hpp" #include "openvic-simulation/types/Colour.hpp" #include "openvic-simulation/types/Date.hpp" #include "openvic-simulation/types/IdentifierRegistry.hpp" @@ -27,7 +20,7 @@ namespace OpenVic { struct GameManager; struct CountryManager; - struct CountryParty : HasIdentifier { + struct CountryParty : HasIdentifierAndColour { friend struct CountryManager; using policy_map_t = ordered_map; @@ -36,7 +29,7 @@ namespace OpenVic { const Date PROPERTY(start_date); const Date PROPERTY(end_date); Ideology const& PROPERTY(ideology); - const policy_map_t PROPERTY(policies); + policy_map_t PROPERTY(policies); CountryParty( std::string_view new_identifier, Date new_start_date, Date new_end_date, Ideology const& new_ideology, @@ -57,12 +50,11 @@ namespace OpenVic { private: GraphicalCultureType const& PROPERTY(graphical_culture); /* Not const to allow elements to be moved, otherwise a copy is forced - * which causes a compile error as the copy constructor has been deleted. - */ + * which causes a compile error as the copy constructor has been deleted. */ IdentifierRegistry IDENTIFIER_REGISTRY_CUSTOM_PLURAL(party, parties); - const unit_names_map_t PROPERTY(unit_names); + unit_names_map_t PROPERTY(unit_names); const bool PROPERTY_CUSTOM_PREFIX(dynamic_tag, is); - const government_colour_map_t PROPERTY(alternative_colours); + government_colour_map_t PROPERTY(alternative_colours); colour_t PROPERTY(primary_unit_colour); colour_t PROPERTY(secondary_unit_colour); colour_t PROPERTY(tertiary_unit_colour); @@ -71,7 +63,7 @@ namespace OpenVic { Country( std::string_view new_identifier, colour_t new_colour, GraphicalCultureType const& new_graphical_culture, IdentifierRegistry&& new_parties, unit_names_map_t&& new_unit_names, bool new_dynamic_tag, - government_colour_map_t&& new_alternative_colours, + government_colour_map_t&& new_alternative_colours, colour_t new_primary_unit_colour, colour_t new_secondary_unit_colour, colour_t new_tertiary_unit_colour ); @@ -93,7 +85,7 @@ namespace OpenVic { bool add_country( std::string_view identifier, colour_t colour, GraphicalCultureType const* graphical_culture, IdentifierRegistry&& parties, Country::unit_names_map_t&& unit_names, bool dynamic_tag, - Country::government_colour_map_t&& alternative_colours, + Country::government_colour_map_t&& alternative_colours, colour_t primary_unit_colour, colour_t secondary_unit_colour, colour_t tertiary_unit_colour ); -- cgit v1.2.3-56-ga3b1