From 84b5ee7a7749e2dbfeb214b4cedd16d5522f4197 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Thu, 28 Sep 2023 21:03:14 +0100 Subject: Removed unnecessary `const std::string_view`s --- src/openvic-simulation/pop/Culture.cpp | 16 ++++++++-------- src/openvic-simulation/pop/Culture.hpp | 16 ++++++++-------- src/openvic-simulation/pop/Pop.cpp | 8 ++++---- src/openvic-simulation/pop/Pop.hpp | 8 ++++---- src/openvic-simulation/pop/Religion.cpp | 8 ++++---- src/openvic-simulation/pop/Religion.hpp | 8 ++++---- 6 files changed, 32 insertions(+), 32 deletions(-) (limited to 'src/openvic-simulation/pop') diff --git a/src/openvic-simulation/pop/Culture.cpp b/src/openvic-simulation/pop/Culture.cpp index 69e1543..6285305 100644 --- a/src/openvic-simulation/pop/Culture.cpp +++ b/src/openvic-simulation/pop/Culture.cpp @@ -7,9 +7,9 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -GraphicalCultureType::GraphicalCultureType(const std::string_view new_identifier) : HasIdentifier { new_identifier } {} +GraphicalCultureType::GraphicalCultureType(std::string_view new_identifier) : HasIdentifier { new_identifier } {} -CultureGroup::CultureGroup(const std::string_view new_identifier, const std::string_view new_leader, +CultureGroup::CultureGroup(std::string_view new_identifier, std::string_view new_leader, GraphicalCultureType const& new_unit_graphical_culture_type, bool new_is_overseas) : HasIdentifier { new_identifier }, leader { new_leader }, unit_graphical_culture_type { new_unit_graphical_culture_type }, @@ -27,7 +27,7 @@ bool CultureGroup::get_is_overseas() const { return is_overseas; } -Culture::Culture(const std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group, +Culture::Culture(std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group, std::vector const& new_first_names, std::vector const& new_last_names) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, group { new_group }, @@ -51,7 +51,7 @@ CultureManager::CultureManager() culture_groups { "culture groups" }, cultures { "cultures" } {} -bool CultureManager::add_graphical_culture_type(const std::string_view identifier) { +bool CultureManager::add_graphical_culture_type(std::string_view identifier) { if (identifier.empty()) { Logger::error("Invalid culture group identifier - empty!"); return false; @@ -59,7 +59,7 @@ bool CultureManager::add_graphical_culture_type(const std::string_view identifie return graphical_culture_types.add_item({ identifier }); } -bool CultureManager::add_culture_group(const std::string_view identifier, const std::string_view leader, GraphicalCultureType const* graphical_culture_type, bool is_overseas) { +bool CultureManager::add_culture_group(std::string_view identifier, std::string_view leader, GraphicalCultureType const* graphical_culture_type, bool is_overseas) { if (!graphical_culture_types.is_locked()) { Logger::error("Cannot register culture groups until graphical culture types are locked!"); return false; @@ -79,7 +79,7 @@ bool CultureManager::add_culture_group(const std::string_view identifier, const return culture_groups.add_item({ identifier, leader, *graphical_culture_type, is_overseas }); } -bool CultureManager::add_culture(const std::string_view identifier, colour_t colour, CultureGroup const* group, std::vector const& first_names, std::vector const& last_names) { +bool CultureManager::add_culture(std::string_view identifier, colour_t colour, CultureGroup const* group, std::vector const& first_names, std::vector const& last_names) { if (!culture_groups.is_locked()) { Logger::error("Cannot register cultures until culture groups are locked!"); return false; @@ -112,7 +112,7 @@ bool CultureManager::load_graphical_culture_type_file(ast::NodeCPtr root) { bool CultureManager::_load_culture_group(size_t& total_expected_cultures, GraphicalCultureType const* default_unit_graphical_culture_type, - const std::string_view culture_group_key, ast::NodeCPtr culture_group_node) { + std::string_view culture_group_key, ast::NodeCPtr culture_group_node) { std::string_view leader; GraphicalCultureType const* unit_graphical_culture_type = default_unit_graphical_culture_type; @@ -134,7 +134,7 @@ bool CultureManager::_load_culture_group(size_t& total_expected_cultures, } bool CultureManager::_load_culture(CultureGroup const* culture_group, - const std::string_view culture_key, ast::NodeCPtr culture_node) { + std::string_view culture_key, ast::NodeCPtr culture_node) { colour_t colour = NULL_COLOUR; std::vector first_names, last_names; diff --git a/src/openvic-simulation/pop/Culture.hpp b/src/openvic-simulation/pop/Culture.hpp index d27c7c9..becc289 100644 --- a/src/openvic-simulation/pop/Culture.hpp +++ b/src/openvic-simulation/pop/Culture.hpp @@ -10,7 +10,7 @@ namespace OpenVic { friend struct CultureManager; private: - GraphicalCultureType(const std::string_view new_identifier); + GraphicalCultureType(std::string_view new_identifier); public: GraphicalCultureType(GraphicalCultureType&&) = default; @@ -26,7 +26,7 @@ namespace OpenVic { // TODO - union tag - CultureGroup(const std::string_view new_identifier, const std::string_view new_leader, GraphicalCultureType const& new_unit_graphical_culture_type, bool new_is_overseas); + CultureGroup(std::string_view new_identifier, std::string_view new_leader, GraphicalCultureType const& new_unit_graphical_culture_type, bool new_is_overseas); public: CultureGroup(CultureGroup&&) = default; @@ -45,7 +45,7 @@ namespace OpenVic { // TODO - radicalism, primary tag - Culture(const std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group, std::vector const& new_first_names, std::vector const& new_last_names); + Culture(std::string_view new_identifier, colour_t new_colour, CultureGroup const& new_group, std::vector const& new_first_names, std::vector const& new_last_names); public: Culture(Culture&&) = default; @@ -62,19 +62,19 @@ namespace OpenVic { IdentifierRegistry cultures; bool _load_culture_group(size_t& total_expected_cultures, GraphicalCultureType const* default_unit_graphical_culture_type, - const std::string_view culture_group_key, ast::NodeCPtr culture_group_node); - bool _load_culture(CultureGroup const* culture_group, const std::string_view culture_key, ast::NodeCPtr node); + std::string_view culture_group_key, ast::NodeCPtr culture_group_node); + bool _load_culture(CultureGroup const* culture_group, std::string_view culture_key, ast::NodeCPtr node); public: CultureManager(); - bool add_graphical_culture_type(const std::string_view identifier); + bool add_graphical_culture_type(std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(GraphicalCultureType, graphical_culture_type) - bool add_culture_group(const std::string_view identifier, const std::string_view leader, GraphicalCultureType const* new_graphical_culture_type, bool is_overseas); + bool add_culture_group(std::string_view identifier, std::string_view leader, GraphicalCultureType const* new_graphical_culture_type, bool is_overseas); IDENTIFIER_REGISTRY_ACCESSORS(CultureGroup, culture_group) - bool add_culture(const std::string_view identifier, colour_t colour, CultureGroup const* group, std::vector const& first_names, std::vector const& last_names); + bool add_culture(std::string_view identifier, colour_t colour, CultureGroup const* group, std::vector const& first_names, std::vector const& last_names); IDENTIFIER_REGISTRY_ACCESSORS(Culture, culture) bool load_graphical_culture_type_file(ast::NodeCPtr root); diff --git a/src/openvic-simulation/pop/Pop.cpp b/src/openvic-simulation/pop/Pop.cpp index d51233b..17bacbf 100644 --- a/src/openvic-simulation/pop/Pop.cpp +++ b/src/openvic-simulation/pop/Pop.cpp @@ -49,7 +49,7 @@ Pop::pop_size_t Pop::get_pop_daily_change() const { return Pop::get_num_promoted() - (Pop::get_num_demoted() + Pop::get_num_migrated()); } -PopType::PopType(const std::string_view new_identifier, colour_t new_colour, +PopType::PopType(std::string_view new_identifier, colour_t new_colour, strata_t new_strata, sprite_t new_sprite, Pop::pop_size_t new_max_size, Pop::pop_size_t new_merge_max_size, bool new_state_capital_only, bool new_demote_migrant, bool new_is_artisan, bool new_is_slave) @@ -117,7 +117,7 @@ ReligionManager const& PopManager::get_religion_manager() const { return religion_manager; } -bool PopManager::add_pop_type(const std::string_view identifier, colour_t colour, PopType::strata_t strata, PopType::sprite_t sprite, +bool PopManager::add_pop_type(std::string_view identifier, colour_t colour, PopType::strata_t strata, PopType::sprite_t sprite, Pop::pop_size_t max_size, Pop::pop_size_t merge_max_size, bool state_capital_only, bool demote_migrant, bool is_artisan, bool is_slave) { if (identifier.empty()) { Logger::error("Invalid pop type identifier - empty!"); @@ -145,7 +145,7 @@ bool PopManager::add_pop_type(const std::string_view identifier, colour_t colour /* REQUIREMENTS: * POP-3, POP-4, POP-5, POP-6, POP-7, POP-8, POP-9, POP-10, POP-11, POP-12, POP-13, POP-14 */ -bool PopManager::load_pop_type_file(const std::string_view filestem, ast::NodeCPtr root) { +bool PopManager::load_pop_type_file(std::string_view filestem, ast::NodeCPtr root) { colour_t colour = NULL_COLOUR; PopType::strata_t strata = PopType::strata_t::POOR; PopType::sprite_t sprite = 0; @@ -210,7 +210,7 @@ bool PopManager::load_pop_type_file(const std::string_view filestem, ast::NodeCP return ret; } -bool PopManager::load_pop_into_province(Province& province, const std::string_view pop_type_identifier, ast::NodeCPtr pop_node) const { +bool PopManager::load_pop_into_province(Province& province, std::string_view pop_type_identifier, ast::NodeCPtr pop_node) const { PopType const* type = get_pop_type_by_identifier(pop_type_identifier); Culture const* culture = nullptr; Religion const* religion = nullptr; diff --git a/src/openvic-simulation/pop/Pop.hpp b/src/openvic-simulation/pop/Pop.hpp index 85d4504..0ab3d06 100644 --- a/src/openvic-simulation/pop/Pop.hpp +++ b/src/openvic-simulation/pop/Pop.hpp @@ -60,7 +60,7 @@ namespace OpenVic { // TODO - rebel composition, life/everyday/luxury needs, country and province migration targets, promote_to targets, ideologies and issues - PopType(const std::string_view new_identifier, colour_t new_colour, strata_t new_strata, sprite_t new_sprite, Pop::pop_size_t new_max_size, Pop::pop_size_t new_merge_max_size, + PopType(std::string_view new_identifier, colour_t new_colour, strata_t new_strata, sprite_t new_sprite, Pop::pop_size_t new_max_size, Pop::pop_size_t new_merge_max_size, bool new_state_capital_only, bool new_demote_migrant, bool new_is_artisan, bool new_is_slave); public: @@ -93,12 +93,12 @@ namespace OpenVic { ReligionManager& get_religion_manager(); ReligionManager const& get_religion_manager() const; - bool add_pop_type(const std::string_view identifier, colour_t new_colour, PopType::strata_t strata, PopType::sprite_t sprite, + bool add_pop_type(std::string_view identifier, colour_t new_colour, PopType::strata_t strata, PopType::sprite_t sprite, Pop::pop_size_t max_size, Pop::pop_size_t merge_max_size, bool state_capital_only, bool demote_migrant, bool is_artisan, bool is_slave); IDENTIFIER_REGISTRY_ACCESSORS(PopType, pop_type) - bool load_pop_type_file(const std::string_view filestem, ast::NodeCPtr root); - bool load_pop_into_province(Province& province, const std::string_view pop_type_identifier, ast::NodeCPtr pop_node) const; + bool load_pop_type_file(std::string_view filestem, ast::NodeCPtr root); + bool load_pop_into_province(Province& province, std::string_view pop_type_identifier, ast::NodeCPtr pop_node) const; }; } diff --git a/src/openvic-simulation/pop/Religion.cpp b/src/openvic-simulation/pop/Religion.cpp index acdcad0..c679e00 100644 --- a/src/openvic-simulation/pop/Religion.cpp +++ b/src/openvic-simulation/pop/Religion.cpp @@ -5,9 +5,9 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -ReligionGroup::ReligionGroup(const std::string_view new_identifier) : HasIdentifier { new_identifier } {} +ReligionGroup::ReligionGroup(std::string_view new_identifier) : HasIdentifier { new_identifier } {} -Religion::Religion(const std::string_view new_identifier, colour_t new_colour, +Religion::Religion(std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon, bool new_pagan) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, group { new_group }, @@ -32,7 +32,7 @@ ReligionManager::ReligionManager() : religion_groups { "religion groups" }, religions { "religions" } {} -bool ReligionManager::add_religion_group(const std::string_view identifier) { +bool ReligionManager::add_religion_group(std::string_view identifier) { if (identifier.empty()) { Logger::error("Invalid religion group identifier - empty!"); return false; @@ -40,7 +40,7 @@ bool ReligionManager::add_religion_group(const std::string_view identifier) { return religion_groups.add_item({ identifier }); } -bool ReligionManager::add_religion(const std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan) { +bool ReligionManager::add_religion(std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan) { if (!religion_groups.is_locked()) { Logger::error("Cannot register religions until religion groups are locked!"); return false; diff --git a/src/openvic-simulation/pop/Religion.hpp b/src/openvic-simulation/pop/Religion.hpp index 8267659..6d1c205 100644 --- a/src/openvic-simulation/pop/Religion.hpp +++ b/src/openvic-simulation/pop/Religion.hpp @@ -11,7 +11,7 @@ namespace OpenVic { friend struct ReligionManager; private: - ReligionGroup(const std::string_view new_identifier); + ReligionGroup(std::string_view new_identifier); public: ReligionGroup(ReligionGroup&&) = default; @@ -27,7 +27,7 @@ namespace OpenVic { const icon_t icon; const bool pagan; - Religion(const std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon, bool new_pagan); + Religion(std::string_view new_identifier, colour_t new_colour, ReligionGroup const& new_group, icon_t new_icon, bool new_pagan); public: Religion(Religion&&) = default; @@ -45,10 +45,10 @@ namespace OpenVic { public: ReligionManager(); - bool add_religion_group(const std::string_view identifier); + bool add_religion_group(std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(ReligionGroup, religion_group) - bool add_religion(const std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan); + bool add_religion(std::string_view identifier, colour_t colour, ReligionGroup const* group, Religion::icon_t icon, bool pagan); IDENTIFIER_REGISTRY_ACCESSORS(Religion, religion) bool load_religion_file(ast::NodeCPtr root); -- cgit v1.2.3-56-ga3b1