aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/country
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2023-11-22 23:11:42 +0100
committer GitHub <noreply@github.com>2023-11-22 23:11:42 +0100
commita54898b7770e0d66b729216173960686c67e58bb (patch)
treeaf8ed836a4789ef94c5bfed27abb713922f45af3 /src/openvic-simulation/country
parente76336cd92639f4ec71088fc4c80aea4c25528cd (diff)
parent738a203e0d8b4df87c42888043b99c13d5d97511 (diff)
Merge pull request #78 from OpenVicProject/property-macro
Refactoring (*mostly* related to the property macro)
Diffstat (limited to 'src/openvic-simulation/country')
-rw-r--r--src/openvic-simulation/country/Country.cpp32
-rw-r--r--src/openvic-simulation/country/Country.hpp26
2 files changed, 8 insertions, 50 deletions
diff --git a/src/openvic-simulation/country/Country.cpp b/src/openvic-simulation/country/Country.cpp
index 6ad13ee..935c409 100644
--- a/src/openvic-simulation/country/Country.cpp
+++ b/src/openvic-simulation/country/Country.cpp
@@ -27,22 +27,6 @@ CountryParty::CountryParty(
) : HasIdentifier { new_identifier }, start_date { new_start_date }, end_date { new_end_date }, ideology { new_ideology },
policies { std::move(new_policies) } {}
-Date CountryParty::get_start_date() const {
- return start_date;
-}
-
-Date CountryParty::get_end_date() const {
- return end_date;
-}
-
-Ideology const& CountryParty::get_ideology() const {
- return ideology;
-}
-
-CountryParty::policy_map_t const& CountryParty::get_policies() const {
- return policies;
-}
-
Country::Country(
std::string_view new_identifier, colour_t new_colour, GraphicalCultureType const& new_graphical_culture,
IdentifierRegistry<CountryParty>&& new_parties, unit_names_map_t&& new_unit_names, bool new_dynamic_tag,
@@ -51,22 +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) } {}
-GraphicalCultureType const& Country::get_graphical_culture() const {
- return graphical_culture;
-}
-
-Country::unit_names_map_t const& Country::get_unit_names() const {
- return unit_names;
-}
-
-bool Country::is_dynamic_tag() const {
- return dynamic_tag;
-}
-
-Country::government_colour_map_t const& Country::get_alternative_colours() const {
- return alternative_colours;
-}
-
CountryManager::CountryManager() : countries { "countries" } {}
bool CountryManager::add_country(
diff --git a/src/openvic-simulation/country/Country.hpp b/src/openvic-simulation/country/Country.hpp
index db1e40b..5b5c528 100644
--- a/src/openvic-simulation/country/Country.hpp
+++ b/src/openvic-simulation/country/Country.hpp
@@ -32,10 +32,10 @@ namespace OpenVic {
using policy_map_t = std::map<IssueGroup const*, Issue const*>;
private:
- const Date start_date;
- const Date end_date;
- Ideology const& ideology;
- const policy_map_t policies;
+ const Date PROPERTY(start_date);
+ const Date PROPERTY(end_date);
+ Ideology const& PROPERTY(ideology);
+ const policy_map_t PROPERTY(policies);
CountryParty(
std::string_view new_identifier, Date new_start_date, Date new_end_date, Ideology const& new_ideology,
@@ -44,11 +44,6 @@ namespace OpenVic {
public:
CountryParty(CountryParty&&) = default;
-
- Date get_start_date() const;
- Date get_end_date() const;
- Ideology const& get_ideology() const;
- policy_map_t const& get_policies() const;
};
/* Generic information about a TAG */
@@ -59,14 +54,14 @@ namespace OpenVic {
using government_colour_map_t = std::map<GovernmentType const*, colour_t>;
private:
- GraphicalCultureType const& graphical_culture;
+ 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.
*/
IdentifierRegistry<CountryParty> parties;
- const unit_names_map_t unit_names;
- const bool dynamic_tag;
- const government_colour_map_t alternative_colours;
+ const unit_names_map_t PROPERTY(unit_names);
+ const bool PROPERTY_CUSTOM_NAME(dynamic_tag, is_dynamic_tag);
+ const government_colour_map_t PROPERTY(alternative_colours);
Country(
std::string_view new_identifier, colour_t new_colour, GraphicalCultureType const& new_graphical_culture,
@@ -78,11 +73,6 @@ namespace OpenVic {
Country(Country&&) = default;
IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(party, parties)
-
- GraphicalCultureType const& get_graphical_culture() const;
- unit_names_map_t const& get_unit_names() const;
- bool is_dynamic_tag() const;
- government_colour_map_t const& get_alternative_colours() const;
};
struct CountryManager {