Implements ConstString in several core places in the library, improving performance.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-27 18:23:23 +01:00
parent 1d3a8da99e
commit 412e0a4d63
17 changed files with 161 additions and 148 deletions

View File

@@ -7,15 +7,15 @@
namespace CreatureLib::Battling {
class CreateCreature {
const BattleLibrary* _library;
std::string _species;
std::string _variant = "default";
Arbutils::CaseInsensitiveConstString _species;
Arbutils::CaseInsensitiveConstString _variant = "default"_cnc;
uint8_t _level;
std::string _nickname = "";
std::string _talent = "";
Library::Gender _gender = static_cast<Library::Gender>(-1);
uint8_t _coloring = 0;
std::string _heldItem = "";
Arbutils::CaseInsensitiveConstString _heldItem = ""_cnc;
uint32_t _identifier = 0;
std::vector<std::tuple<const Library::AttackData*, AttackLearnMethod>> _attacks = {};
@@ -23,10 +23,11 @@ namespace CreatureLib::Battling {
CreateCreature(const BattleLibrary* library, std::string species, uint8_t level)
: _library(library), _species(std::move(species)), _level(level) {}
CreateCreature* WithVariant(std::string variant);
CreateCreature* WithVariant(const Arbutils::CaseInsensitiveConstString& variant);
CreateCreature* WithNickname(std::string nickname);
CreateCreature* WithGender(Library::Gender gender);
CreateCreature* WithAttack(const std::string& attackName, AttackLearnMethod learnMethod);
CreateCreature* WithAttack(const Arbutils::CaseInsensitiveConstString& attackName,
AttackLearnMethod learnMethod);
Creature* Create();
};