Mark TryGetVariant as const.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-02-13 17:37:37 +01:00
parent 2ea5f9f9bd
commit 667821df28
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ bool CreatureSpecies::HasVariant(const std::string& name) const {
return _variants.find(key) != _variants.end(); return _variants.find(key) != _variants.end();
} }
bool CreatureSpecies::TryGetVariant(const std::string& name, const SpeciesVariant*& out) { bool CreatureSpecies::TryGetVariant(const std::string& name, const SpeciesVariant*& out) const {
auto key = name; auto key = name;
std::transform(key.begin(), key.end(), key.end(), ::tolower); std::transform(key.begin(), key.end(), key.end(), ::tolower);
auto find = _variants.find(key); auto find = _variants.find(key);

View File

@ -37,7 +37,7 @@ namespace CreatureLib::Library {
inline uint8_t GetCaptureRate() const { return _captureRate; } inline uint8_t GetCaptureRate() const { return _captureRate; }
[[nodiscard]] bool HasVariant(const std::string& key) const; [[nodiscard]] bool HasVariant(const std::string& key) const;
[[nodiscard]] bool TryGetVariant(const std::string& name, const SpeciesVariant*& out); [[nodiscard]] bool TryGetVariant(const std::string& name, const SpeciesVariant*& out) const;
[[nodiscard]] const SpeciesVariant* GetVariant(const std::string& key) const; [[nodiscard]] const SpeciesVariant* GetVariant(const std::string& key) const;
[[nodiscard]] Gender GetRandomGender(Core::Random& rand) const; [[nodiscard]] Gender GetRandomGender(Core::Random& rand) const;
[[nodiscard]] const std::string& GetName() const; [[nodiscard]] const std::string& GetName() const;