Implements ConstString in several core places in the library, improving performance.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -13,7 +13,11 @@ Battling::Creature::Creature(const BattleLibrary* library, const Library::Creatu
|
||||
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience),
|
||||
_uniqueIdentifier(uid), _gender(gender), _coloring(coloring), _heldItem(heldItem), _nickname(std::move(nickname)),
|
||||
_talentIndex(talent), _hasOverridenTalent(false), _attacks(std::move(attacks)) {
|
||||
|
||||
_activeTalent = _library->LoadScript(ScriptCategory::Talent, GetActiveTalent());
|
||||
if (_nickname.empty()) {
|
||||
_nickname = species->GetName().std_str();
|
||||
}
|
||||
}
|
||||
|
||||
void Battling::Creature::ChangeLevel(int8_t amount) {
|
||||
@@ -21,12 +25,6 @@ void Battling::Creature::ChangeLevel(int8_t amount) {
|
||||
RecalculateFlatStats();
|
||||
}
|
||||
|
||||
const std::string& Battling::Creature::GetNickname() const {
|
||||
if (_nickname.empty())
|
||||
return _species->GetName();
|
||||
return _nickname;
|
||||
}
|
||||
|
||||
const std::string& Battling::Creature::GetActiveTalent() const {
|
||||
if (_hasOverridenTalent) {
|
||||
return _overridenTalentName;
|
||||
@@ -178,7 +176,7 @@ const Library::SpeciesVariant* Battling::Creature::GetDisplayVariant() const {
|
||||
variant = _variant;
|
||||
return variant;
|
||||
}
|
||||
void Battling::Creature::SetHeldItem(const std::string& itemName) {
|
||||
void Battling::Creature::SetHeldItem(const Arbutils::CaseInsensitiveConstString& itemName) {
|
||||
const Library::Item* item;
|
||||
if (!_library->GetItemLibrary()->TryGet(itemName, item)) {
|
||||
throw CreatureException("Item not found.");
|
||||
|
||||
Reference in New Issue
Block a user