Fix variants lowercasing causing stack smashing error.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
667821df28
commit
a6f91faba4
|
@ -9,13 +9,13 @@ CreatureSpecies::CreatureSpecies(uint16_t id, std::string name, const SpeciesVar
|
|||
|
||||
bool CreatureSpecies::HasVariant(const std::string& name) const {
|
||||
auto key = name;
|
||||
std::transform(key.begin(), key.end(), key.end(), ::tolower);
|
||||
std::transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
return _variants.find(key) != _variants.end();
|
||||
}
|
||||
|
||||
bool CreatureSpecies::TryGetVariant(const std::string& name, const SpeciesVariant*& out) const {
|
||||
auto key = name;
|
||||
std::transform(key.begin(), key.end(), key.end(), ::tolower);
|
||||
std::transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
auto find = _variants.find(key);
|
||||
if (find != _variants.end()) {
|
||||
out = find->second;
|
||||
|
@ -26,13 +26,13 @@ bool CreatureSpecies::TryGetVariant(const std::string& name, const SpeciesVarian
|
|||
|
||||
const SpeciesVariant* CreatureSpecies::GetVariant(const std::string& name) const {
|
||||
auto key = name;
|
||||
std::transform(key.begin(), key.end(), key.end(), ::tolower);
|
||||
std::transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
return _variants.at(key);
|
||||
}
|
||||
|
||||
void CreatureSpecies::SetVariant(const std::string& name, const SpeciesVariant* variant) {
|
||||
auto key = name;
|
||||
std::transform(key.begin(), key.end(), key.end(), ::tolower);
|
||||
std::transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
auto find = _variants.find(key);
|
||||
if (find != _variants.end()) {
|
||||
delete find->second;
|
||||
|
|
Loading…
Reference in New Issue