From 4ef33d4df6198e613b0f27406d49978c8ea2fb97 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sun, 10 Dec 2023 23:15:41 +0100 Subject: feat: improved identifier registry macro --- src/openvic-simulation/country/Country.cpp | 2 -- src/openvic-simulation/country/Country.hpp | 9 ++------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src/openvic-simulation/country') diff --git a/src/openvic-simulation/country/Country.cpp b/src/openvic-simulation/country/Country.cpp index 935c409..cb4de8a 100644 --- a/src/openvic-simulation/country/Country.cpp +++ b/src/openvic-simulation/country/Country.cpp @@ -35,8 +35,6 @@ Country::Country( parties { std::move(new_parties) }, unit_names { std::move(new_unit_names) }, dynamic_tag { new_dynamic_tag }, alternative_colours { std::move(new_alternative_colours) } {} -CountryManager::CountryManager() : countries { "countries" } {} - 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, diff --git a/src/openvic-simulation/country/Country.hpp b/src/openvic-simulation/country/Country.hpp index 5d25b33..c35cf4f 100644 --- a/src/openvic-simulation/country/Country.hpp +++ b/src/openvic-simulation/country/Country.hpp @@ -58,7 +58,7 @@ namespace OpenVic { /* 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. */ - IdentifierRegistry parties; + IdentifierRegistry IDENTIFIER_REGISTRY_CUSTOM_PLURAL(party, parties); const unit_names_map_t PROPERTY(unit_names); const bool PROPERTY_CUSTOM_PREFIX(dynamic_tag, is); const government_colour_map_t PROPERTY(alternative_colours); @@ -72,28 +72,23 @@ namespace OpenVic { public: Country(Country&&) = default; - IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(party, parties) - // TODO - get_colour including alternative colours }; struct CountryManager { private: - IdentifierRegistry countries; + IdentifierRegistry IDENTIFIER_REGISTRY_CUSTOM_PLURAL(country, countries); NodeTools::node_callback_t load_country_party( PoliticsManager const& politics_manager, IdentifierRegistry& country_parties ) const; public: - CountryManager(); - 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 ); - IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(country, countries) bool load_countries(GameManager const& game_manager, Dataloader const& dataloader, ast::NodeCPtr root); bool load_country_data_file( -- cgit v1.2.3-56-ga3b1