diff options
author | Hop311 <Hop3114@gmail.com> | 2023-08-12 18:54:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-12 18:54:55 +0200 |
commit | d3c6ff1809b88b4c99163402f30b6d10c787510f (patch) | |
tree | e4bf26ecfef160e7df7670e73af7f154f1550308 /src/openvic/map/Province.cpp | |
parent | 538e7dc4ec44c4d09a6a654f10229e6392653a50 (diff) | |
parent | afc16e76ba699b24ba1ef1cb1b658ef421c84430 (diff) |
Merge pull request #11 from OpenVicProject/string_view
Changed IdentifierRegistry to use std::string_view when looking up a std::string key
Diffstat (limited to 'src/openvic/map/Province.cpp')
-rw-r--r-- | src/openvic/map/Province.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/openvic/map/Province.cpp b/src/openvic/map/Province.cpp index 0b6d1f4..ea284b6 100644 --- a/src/openvic/map/Province.cpp +++ b/src/openvic/map/Province.cpp @@ -6,7 +6,7 @@ using namespace OpenVic; -Province::Province(index_t new_index, std::string const& new_identifier, colour_t new_colour) +Province::Province(const std::string_view new_identifier, colour_t new_colour, index_t new_index) : HasIdentifierAndColour { new_identifier, new_colour, false }, index { new_index }, buildings { "buildings" } { @@ -41,7 +41,7 @@ void Province::reset_buildings() { buildings.reset(); } -Building const* Province::get_building_by_identifier(std::string const& identifier) const { +Building const* Province::get_building_by_identifier(const std::string_view identifier) const { return buildings.get_item_by_identifier(identifier); } @@ -49,7 +49,7 @@ std::vector<Building> const& Province::get_buildings() const { return buildings.get_items(); } -return_t Province::expand_building(std::string const& building_type_identifier) { +return_t Province::expand_building(const std::string_view building_type_identifier) { Building* building = buildings.get_item_by_identifier(building_type_identifier); if (building == nullptr) return FAILURE; return building->expand(); |