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/map/Building.cpp | 4 ++-- src/openvic-simulation/map/Building.hpp | 4 ++-- src/openvic-simulation/map/Map.cpp | 10 +++++----- src/openvic-simulation/map/Map.hpp | 10 +++++----- src/openvic-simulation/map/Province.cpp | 4 ++-- src/openvic-simulation/map/Province.hpp | 4 ++-- src/openvic-simulation/map/Region.cpp | 2 +- src/openvic-simulation/map/Region.hpp | 2 +- src/openvic-simulation/map/TerrainType.cpp | 8 ++++---- src/openvic-simulation/map/TerrainType.hpp | 8 ++++---- 10 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/openvic-simulation/map') diff --git a/src/openvic-simulation/map/Building.cpp b/src/openvic-simulation/map/Building.cpp index 29ee354..4e26ab9 100644 --- a/src/openvic-simulation/map/Building.cpp +++ b/src/openvic-simulation/map/Building.cpp @@ -105,7 +105,7 @@ bool Building::spawned_railway_track() const { return spawn_railway_track; } -BuildingType::BuildingType(const std::string_view new_identifier) : HasIdentifier { new_identifier } {} +BuildingType::BuildingType(std::string_view new_identifier) : HasIdentifier { new_identifier } {} BuildingInstance::BuildingInstance(Building const& building) : HasIdentifier { building.get_identifier() }, building { building } {} @@ -176,7 +176,7 @@ void BuildingInstance::tick(Date const& today) { BuildingManager::BuildingManager() : building_types { "building types" }, buildings { "buildings" } {} -bool BuildingManager::add_building_type(const std::string_view identifier) { +bool BuildingManager::add_building_type(std::string_view identifier) { if (identifier.empty()) { Logger::error("Invalid building type identifier - empty!"); return false; diff --git a/src/openvic-simulation/map/Building.hpp b/src/openvic-simulation/map/Building.hpp index 9b11c1c..1c2ded0 100644 --- a/src/openvic-simulation/map/Building.hpp +++ b/src/openvic-simulation/map/Building.hpp @@ -103,7 +103,7 @@ namespace OpenVic { friend struct BuildingManager; private: - BuildingType(const std::string_view new_identifier); + BuildingType(std::string_view new_identifier); public: BuildingType(BuildingType&&) = default; @@ -161,7 +161,7 @@ namespace OpenVic { public: BuildingManager(); - bool add_building_type(const std::string_view identifier); + bool add_building_type(std::string_view identifier); IDENTIFIER_REGISTRY_ACCESSORS(BuildingType, building_type) bool add_building(std::string_view identifier, ARGS); diff --git a/src/openvic-simulation/map/Map.cpp b/src/openvic-simulation/map/Map.cpp index 7ecff39..386e7be 100644 --- a/src/openvic-simulation/map/Map.cpp +++ b/src/openvic-simulation/map/Map.cpp @@ -10,7 +10,7 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -Mapmode::Mapmode(const std::string_view new_identifier, index_t new_index, colour_func_t new_colour_func) +Mapmode::Mapmode(std::string_view new_identifier, index_t new_index, colour_func_t new_colour_func) : HasIdentifier { new_identifier }, index { new_index }, colour_func { new_colour_func } { @@ -32,7 +32,7 @@ Map::Map() : provinces { "provinces" }, regions { "regions" }, mapmodes { "mapmodes" } {} -bool Map::add_province(const std::string_view identifier, colour_t colour) { +bool Map::add_province(std::string_view identifier, colour_t colour) { if (provinces.size() >= max_provinces) { Logger::error("The map's province list is full - maximum number of provinces is ", max_provinces, " (this can be at most ", Province::MAX_INDEX, ")"); return false; @@ -55,7 +55,7 @@ bool Map::add_province(const std::string_view identifier, colour_t colour) { return provinces.add_item(std::move(new_province)); } -bool Map::set_water_province(const std::string_view identifier) { +bool Map::set_water_province(std::string_view identifier) { if (water_provinces.is_locked()) { Logger::error("The map's water provinces have already been locked!"); return false; @@ -91,7 +91,7 @@ void Map::lock_water_provinces() { Logger::info("Locked water provinces after registering ", water_provinces.size()); } -bool Map::add_region(const std::string_view identifier, std::vector const& province_identifiers) { +bool Map::add_region(std::string_view identifier, std::vector const& province_identifiers) { if (identifier.empty()) { Logger::error("Invalid region identifier - empty!"); return false; @@ -203,7 +203,7 @@ TerrainTypeManager const& Map::get_terrain_type_manager() const { return terrain_type_manager; } -bool Map::add_mapmode(const std::string_view identifier, Mapmode::colour_func_t colour_func) { +bool Map::add_mapmode(std::string_view identifier, Mapmode::colour_func_t colour_func) { if (identifier.empty()) { Logger::error("Invalid mapmode identifier - empty!"); return false; diff --git a/src/openvic-simulation/map/Map.hpp b/src/openvic-simulation/map/Map.hpp index 99c0bce..9c97960 100644 --- a/src/openvic-simulation/map/Map.hpp +++ b/src/openvic-simulation/map/Map.hpp @@ -21,7 +21,7 @@ namespace OpenVic { const index_t index; const colour_func_t colour_func; - Mapmode(const std::string_view new_identifier, index_t new_index, colour_func_t new_colour_func); + Mapmode(std::string_view new_identifier, index_t new_index, colour_func_t new_colour_func); public: static const Mapmode ERROR_MAPMODE; @@ -69,11 +69,11 @@ namespace OpenVic { public: Map(); - bool add_province(const std::string_view identifier, colour_t colour); + bool add_province(std::string_view identifier, colour_t colour); IDENTIFIER_REGISTRY_ACCESSORS(Province, province) IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS(Province, province) - bool set_water_province(const std::string_view identifier); + bool set_water_province(std::string_view identifier); bool set_water_province_list(std::vector const& list); void lock_water_provinces(); @@ -92,11 +92,11 @@ namespace OpenVic { TerrainTypeManager& get_terrain_type_manager(); TerrainTypeManager const& get_terrain_type_manager() const; - bool add_region(const std::string_view identifier, std::vector const& province_identifiers); + bool add_region(std::string_view identifier, std::vector const& province_identifiers); IDENTIFIER_REGISTRY_ACCESSORS(Region, region) IDENTIFIER_REGISTRY_NON_CONST_ACCESSORS(Region, region) - bool add_mapmode(const std::string_view identifier, Mapmode::colour_func_t colour_func); + bool add_mapmode(std::string_view identifier, Mapmode::colour_func_t colour_func); IDENTIFIER_REGISTRY_ACCESSORS(Mapmode, mapmode) Mapmode const* get_mapmode_by_index(size_t index) const; static constexpr size_t MAPMODE_COLOUR_SIZE = 4; diff --git a/src/openvic-simulation/map/Province.cpp b/src/openvic-simulation/map/Province.cpp index 21bdb85..fa514eb 100644 --- a/src/openvic-simulation/map/Province.cpp +++ b/src/openvic-simulation/map/Province.cpp @@ -3,7 +3,7 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -Province::Province(const std::string_view new_identifier, colour_t new_colour, index_t new_index) +Province::Province(std::string_view new_identifier, colour_t new_colour, index_t new_index) : HasIdentifierAndColour { new_identifier, new_colour, false, false }, index { new_index }, buildings { "buildings", false } { assert(index != NULL_INDEX); @@ -47,7 +47,7 @@ void Province::reset_buildings() { buildings.reset(); } -bool Province::expand_building(const std::string_view building_type_identifier) { +bool Province::expand_building(std::string_view building_type_identifier) { BuildingInstance* building = buildings.get_item_by_identifier(building_type_identifier); if (building == nullptr) return false; return building->expand(); diff --git a/src/openvic-simulation/map/Province.hpp b/src/openvic-simulation/map/Province.hpp index 349c16d..e15d8d3 100644 --- a/src/openvic-simulation/map/Province.hpp +++ b/src/openvic-simulation/map/Province.hpp @@ -60,7 +60,7 @@ namespace OpenVic { void _set_terrain_type(TerrainType const* type); - Province(const std::string_view new_identifier, colour_t new_colour, index_t new_index); + Province(std::string_view new_identifier, colour_t new_colour, index_t new_index); public: Province(Province&&) = default; @@ -76,7 +76,7 @@ namespace OpenVic { bool add_building(BuildingInstance&& building_instance); IDENTIFIER_REGISTRY_ACCESSORS(BuildingInstance, building) void reset_buildings(); - bool expand_building(const std::string_view building_type_identifier); + bool expand_building(std::string_view building_type_identifier); Good const* get_rgo() const; std::string to_string() const; diff --git a/src/openvic-simulation/map/Region.cpp b/src/openvic-simulation/map/Region.cpp index c0422de..477dc9e 100644 --- a/src/openvic-simulation/map/Region.cpp +++ b/src/openvic-simulation/map/Region.cpp @@ -63,7 +63,7 @@ ProvinceSet::provinces_t const& ProvinceSet::get_provinces() const { return provinces; } -Region::Region(const std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta) +Region::Region(std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta) : HasIdentifier { new_identifier }, ProvinceSet { std::move(new_provinces) }, meta { new_meta } { lock(); } diff --git a/src/openvic-simulation/map/Region.hpp b/src/openvic-simulation/map/Region.hpp index d68033b..157b643 100644 --- a/src/openvic-simulation/map/Region.hpp +++ b/src/openvic-simulation/map/Region.hpp @@ -38,7 +38,7 @@ namespace OpenVic { */ const bool meta; - Region(const std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta); + Region(std::string_view new_identifier, provinces_t&& new_provinces, bool new_meta); public: Region(Region&&) = default; diff --git a/src/openvic-simulation/map/TerrainType.cpp b/src/openvic-simulation/map/TerrainType.cpp index e688625..24cfb7d 100644 --- a/src/openvic-simulation/map/TerrainType.cpp +++ b/src/openvic-simulation/map/TerrainType.cpp @@ -5,14 +5,14 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -TerrainType::TerrainType(const std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, bool new_is_water) +TerrainType::TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, bool new_is_water) : HasIdentifierAndColour { new_identifier, new_colour, true, false }, ModifierValue { std::move(new_values) }, is_water { new_is_water } {} bool TerrainType::get_is_water() const { return is_water; } -TerrainTypeMapping::TerrainTypeMapping(const std::string_view new_identifier, TerrainType const& new_type, +TerrainTypeMapping::TerrainTypeMapping(std::string_view new_identifier, TerrainType const& new_type, std::vector&& new_terrain_indicies, index_t new_priority, bool new_has_texture) : HasIdentifier { new_identifier }, type { new_type }, terrain_indicies { std::move(new_terrain_indicies) }, priority { new_priority }, has_texture { new_has_texture } {} @@ -35,7 +35,7 @@ bool TerrainTypeMapping::get_has_texture() const { TerrainTypeManager::TerrainTypeManager() : terrain_types { "terrain types" }, terrain_type_mappings { "terrain type mappings" } {} -bool TerrainTypeManager::add_terrain_type(const std::string_view identifier, colour_t colour, ModifierValue&& values, bool is_water) { +bool TerrainTypeManager::add_terrain_type(std::string_view identifier, colour_t colour, ModifierValue&& values, bool is_water) { if (identifier.empty()) { Logger::error("Invalid terrain type identifier - empty!"); return false; @@ -47,7 +47,7 @@ bool TerrainTypeManager::add_terrain_type(const std::string_view identifier, col return terrain_types.add_item({ identifier, colour, std::move(values), is_water }); } -bool TerrainTypeManager::add_terrain_type_mapping(const std::string_view identifier, TerrainType const* type, +bool TerrainTypeManager::add_terrain_type_mapping(std::string_view identifier, TerrainType const* type, std::vector&& terrain_indicies, TerrainTypeMapping::index_t priority, bool has_texture) { if (!terrain_types.is_locked()) { Logger::error("Cannot register terrain type mappings until terrain types are locked!"); diff --git a/src/openvic-simulation/map/TerrainType.hpp b/src/openvic-simulation/map/TerrainType.hpp index 0cc28c2..3b491ae 100644 --- a/src/openvic-simulation/map/TerrainType.hpp +++ b/src/openvic-simulation/map/TerrainType.hpp @@ -11,7 +11,7 @@ namespace OpenVic { private: const bool is_water; - TerrainType(const std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, bool new_is_water); + TerrainType(std::string_view new_identifier, colour_t new_colour, ModifierValue&& new_values, bool new_is_water); public: TerrainType(TerrainType&&) = default; @@ -30,7 +30,7 @@ namespace OpenVic { const index_t priority; const bool has_texture; - TerrainTypeMapping(const std::string_view new_identifier, TerrainType const& new_type, std::vector&& new_terrain_indicies, index_t new_priority, bool new_has_texture); + TerrainTypeMapping(std::string_view new_identifier, TerrainType const& new_type, std::vector&& new_terrain_indicies, index_t new_priority, bool new_has_texture); public: TerrainTypeMapping(TerrainTypeMapping&&) = default; @@ -56,10 +56,10 @@ namespace OpenVic { public: TerrainTypeManager(); - bool add_terrain_type(const std::string_view identifier, colour_t colour, ModifierValue&& values, bool is_water); + bool add_terrain_type(std::string_view identifier, colour_t colour, ModifierValue&& values, bool is_water); IDENTIFIER_REGISTRY_ACCESSORS(TerrainType, terrain_type) - bool add_terrain_type_mapping(const std::string_view identifier, TerrainType const* type, + bool add_terrain_type_mapping(std::string_view identifier, TerrainType const* type, std::vector&& terrain_indicies, TerrainTypeMapping::index_t priority, bool has_texture); IDENTIFIER_REGISTRY_ACCESSORS(TerrainTypeMapping, terrain_type_mapping) -- cgit v1.2.3-56-ga3b1