diff options
Diffstat (limited to 'src/openvic-simulation/country')
-rw-r--r-- | src/openvic-simulation/country/Country.cpp | 76 | ||||
-rw-r--r-- | src/openvic-simulation/country/Country.hpp | 23 |
2 files changed, 36 insertions, 63 deletions
diff --git a/src/openvic-simulation/country/Country.cpp b/src/openvic-simulation/country/Country.cpp index d666411..fc867d3 100644 --- a/src/openvic-simulation/country/Country.cpp +++ b/src/openvic-simulation/country/Country.cpp @@ -42,17 +42,10 @@ const std::vector<const Issue*>& CountryParty::get_policies() const { } CountryParty::CountryParty( - std::string_view new_name, - Date new_start_date, - Date new_end_date, - const Ideology& new_ideology, + std::string_view new_name, Date new_start_date, Date new_end_date, const Ideology& new_ideology, std::vector<const Issue*>&& new_policies -) : name { new_name }, - start_date { new_start_date }, - end_date { new_end_date }, - ideology { new_ideology }, - policies { std::move(new_policies) } { -} +) : name { new_name }, start_date { new_start_date }, end_date { new_end_date }, ideology { new_ideology }, + policies { std::move(new_policies) } {} std::string_view UnitNames::get_identifier() const { return identifier; @@ -62,12 +55,8 @@ const std::vector<std::string>& UnitNames::get_names() const { return names; } -UnitNames::UnitNames( - std::string_view new_identifier, - std::vector<std::string>&& new_names -) : identifier { new_identifier }, - names { std::move(new_names) } { -} +UnitNames::UnitNames(std::string_view new_identifier, std::vector<std::string>&& new_names) + : identifier { new_identifier }, names { std::move(new_names) } {} const GraphicalCultureType& Country::get_graphical_culture() const { return graphical_culture; @@ -90,44 +79,33 @@ const bool Country::is_dynamic_tag() const { } Country::Country( - std::string_view new_identifier, - colour_t new_color, - const GraphicalCultureType& new_graphical_culture, - std::vector<CountryParty>&& new_parties, - std::vector<UnitNames>&& new_unit_names, - bool new_dynamic_tag, + std::string_view new_identifier, colour_t new_color, const GraphicalCultureType& new_graphical_culture, + std::vector<CountryParty>&& new_parties, std::vector<UnitNames>&& new_unit_names, bool new_dynamic_tag, std::map<const GovernmentType*, colour_t>&& new_alternative_colours -) : HasIdentifierAndColour(new_identifier, new_color, false, false), - graphical_culture { new_graphical_culture }, - parties { std::move(new_parties) }, - unit_names { std::move(new_unit_names) }, - dynamic_tag { new_dynamic_tag }, - alternative_colours { std::move(new_alternative_colours) } { -} +) : HasIdentifierAndColour(new_identifier, new_color, false, false), graphical_culture { new_graphical_culture }, + 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" } { -} +CountryManager::CountryManager() : countries { "countries" } {} bool CountryManager::add_country( - std::string_view identifier, - colour_t color, - const GraphicalCultureType& graphical_culture, - std::vector<CountryParty>&& parties, - std::vector<UnitNames>&& unit_names, - bool dynamic_tag, + std::string_view identifier, colour_t color, const GraphicalCultureType& graphical_culture, + std::vector<CountryParty>&& parties, std::vector<UnitNames>&& unit_names, bool dynamic_tag, std::map<const GovernmentType*, colour_t>&& alternative_colours ) { if (identifier.empty()) { return false; } - return countries.add_item({ identifier, color, graphical_culture, std::move(parties), - std::move(unit_names), dynamic_tag, std::move(alternative_colours) }); + return countries.add_item({ + identifier, color, graphical_culture, std::move(parties), std::move(unit_names), + dynamic_tag, std::move(alternative_colours) + }); } -bool CountryManager::load_country_data_file(GameManager& game_manager, - std::string_view name, bool is_dynamic, ast::NodeCPtr root) { +bool CountryManager::load_country_data_file( + GameManager& game_manager, std::string_view name, bool is_dynamic, ast::NodeCPtr root +) { colour_t color; const GraphicalCultureType* graphical_culture; std::vector<CountryParty> country_parties; @@ -140,12 +118,16 @@ bool CountryManager::load_country_data_file(GameManager& game_manager, bool ret = game_manager.get_politics_manager().get_government_type_manager() .expect_government_type_str(assign_variable_callback_pointer(colour_gov_type))(key); - if (!ret) return false; + if (!ret) { + return false; + } colour_t alternative_colour; ret &= expect_colour(assign_variable_callback(alternative_colour))(value); - if (!ret) return false; + if (!ret) { + return false; + } return alternative_colours.emplace(std::move(colour_gov_type), std::move(alternative_colour)).second; }, @@ -211,7 +193,9 @@ bool CountryManager::load_country_data_file(GameManager& game_manager, }) )(root); - ret &= add_country(name, color, *graphical_culture, std::move(country_parties), - std::move(unit_names), is_dynamic, std::move(alternative_colours)); + ret &= add_country( + name, color, *graphical_culture, std::move(country_parties), std::move(unit_names), is_dynamic, + std::move(alternative_colours) + ); return ret; } diff --git a/src/openvic-simulation/country/Country.hpp b/src/openvic-simulation/country/Country.hpp index 8077698..66ce2e6 100644 --- a/src/openvic-simulation/country/Country.hpp +++ b/src/openvic-simulation/country/Country.hpp @@ -37,10 +37,7 @@ namespace OpenVic { const std::vector<Issue const*> policies; CountryParty( - std::string_view new_name, - Date new_start_date, - Date new_end_date, - const Ideology& new_ideology, + std::string_view new_name, Date new_start_date, Date new_end_date, const Ideology& new_ideology, std::vector<const Issue*>&& new_policies ); @@ -77,12 +74,8 @@ namespace OpenVic { const std::map<const GovernmentType*, colour_t> alternative_colours; Country( - std::string_view new_identifier, - colour_t new_color, - const GraphicalCultureType& new_graphical_culture, - std::vector<CountryParty>&& new_parties, - std::vector<UnitNames>&& new_unit_names, - const bool new_dynamic_tag, + std::string_view new_identifier, colour_t new_color, const GraphicalCultureType& new_graphical_culture, + std::vector<CountryParty>&& new_parties, std::vector<UnitNames>&& new_unit_names, const bool new_dynamic_tag, std::map<const GovernmentType*, colour_t>&& new_alternative_colours ); @@ -102,16 +95,12 @@ namespace OpenVic { CountryManager(); bool add_country( - std::string_view identifier, - colour_t color, - const GraphicalCultureType& graphical_culture, - std::vector<CountryParty>&& parties, - std::vector<UnitNames>&& unit_names, - bool dynamic_tag, + std::string_view identifier, colour_t color, const GraphicalCultureType& graphical_culture, + std::vector<CountryParty>&& parties, std::vector<UnitNames>&& unit_names, bool dynamic_tag, std::map<const GovernmentType*, colour_t>&& alternative_colours ); IDENTIFIER_REGISTRY_ACCESSORS_CUSTOM_PLURAL(country, countries); bool load_country_data_file(GameManager& game_manager, std::string_view name, bool is_dynamic, ast::NodeCPtr root); }; -}
\ No newline at end of file +} |