Add ConstString to several other places where context isn't changed much during runtime.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
469fcfe280
commit
5a05a2f4d3
|
@ -38,6 +38,6 @@ const DamageLibrary* BattleLibrary::GetDamageLibrary() const { return _damageLib
|
|||
|
||||
const MiscLibrary* BattleLibrary::GetMiscLibrary() const { return _miscLibrary; }
|
||||
|
||||
Script* BattleLibrary::LoadScript(ScriptCategory category, const std::string& scriptName) const {
|
||||
Script* BattleLibrary::LoadScript(ScriptCategory category, const ConstString& scriptName) const {
|
||||
return _scriptResolver->LoadScript(category, scriptName);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace CreatureLib::Battling {
|
|||
[[nodiscard]] const MiscLibrary* GetMiscLibrary() const;
|
||||
[[nodiscard]] const ExperienceLibrary* GetExperienceLibrary() const { return _experienceLibrary; }
|
||||
|
||||
[[nodiscard]] Script* LoadScript(ScriptCategory category, const std::string& scriptName) const;
|
||||
[[nodiscard]] Script* LoadScript(ScriptCategory category, const ConstString& scriptName) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ void Battle::ValidateBattleState() {
|
|||
this->_battleResult = BattleResult::Conclusive(winningSide);
|
||||
this->_hasEnded = true;
|
||||
}
|
||||
void Battle::AddVolatileScript(const std::string& key) {
|
||||
void Battle::AddVolatileScript(const ConstString& key) {
|
||||
auto script = _volatile.Get(key);
|
||||
if (script != nullptr) {
|
||||
script->Stack();
|
||||
|
@ -129,6 +129,6 @@ void Battle::AddVolatileScript(const std::string& key) {
|
|||
return _volatile.Add(script);
|
||||
}
|
||||
void Battle::AddVolatileScript(Script* script) { return _volatile.Add(script); }
|
||||
void Battle::RemoveVolatileScript(const std::string& name) { _volatile.Remove(name); }
|
||||
void Battle::RemoveVolatileScript(const ConstString& name) { _volatile.Remove(name); }
|
||||
void Battle::RemoveVolatileScript(Script* script) { _volatile.Remove(script->GetName()); }
|
||||
void Battle::HasVolatileScript(const std::string& name) const { _volatile.Has(name); }
|
||||
void Battle::HasVolatileScript(const ConstString& name) const { _volatile.Has(name); }
|
||||
|
|
|
@ -75,12 +75,12 @@ namespace CreatureLib::Battling {
|
|||
inline const BattleResult& GetResult() const { return _battleResult; }
|
||||
|
||||
const std::vector<BattleSide*>& GetSides() const { return _sides; }
|
||||
Script* GetVolatileScript(const std::string& key) const { return _volatile.Get(key); }
|
||||
void AddVolatileScript(const std::string& key);
|
||||
Script* GetVolatileScript(const ConstString& key) const { return _volatile.Get(key); }
|
||||
void AddVolatileScript(const ConstString& key);
|
||||
void AddVolatileScript(Script* script);
|
||||
void RemoveVolatileScript(const std::string& name);
|
||||
void RemoveVolatileScript(const ConstString& name);
|
||||
void RemoveVolatileScript(Script* script);
|
||||
void HasVolatileScript(const std::string& name) const;
|
||||
void HasVolatileScript(const ConstString& name) const;
|
||||
|
||||
void RegisterEventListener(EVENT_HOOK_FUNC(listener)) { this->_eventHook.RegisterListener(listener); }
|
||||
void TriggerEventListener(EventData* data) { this->_eventHook.TriggerEvent(data); }
|
||||
|
|
|
@ -25,7 +25,7 @@ void Battling::Creature::ChangeLevel(int8_t amount) {
|
|||
RecalculateFlatStats();
|
||||
}
|
||||
|
||||
const std::string& Battling::Creature::GetActiveTalent() const {
|
||||
const ConstString& Battling::Creature::GetActiveTalent() const {
|
||||
if (_hasOverridenTalent) {
|
||||
return _overridenTalentName;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void Battling::Creature::Heal(uint32_t amount) {
|
|||
_currentHealth = newHealth;
|
||||
}
|
||||
|
||||
void Battling::Creature::OverrideActiveTalent(const std::string& talent) {
|
||||
void Battling::Creature::OverrideActiveTalent(const ConstString& talent) {
|
||||
_hasOverridenTalent = true;
|
||||
_activeTalent->OnRemove();
|
||||
delete _activeTalent;
|
||||
|
@ -183,7 +183,7 @@ void Battling::Creature::SetHeldItem(const Arbutils::CaseInsensitiveConstString&
|
|||
}
|
||||
_heldItem = item;
|
||||
}
|
||||
void Battling::Creature::AddVolatileScript(const std::string& name) {
|
||||
void Battling::Creature::AddVolatileScript(const ConstString& name) {
|
||||
auto script = _volatile.Get(name);
|
||||
if (script != nullptr) {
|
||||
script->Stack();
|
||||
|
@ -194,6 +194,6 @@ void Battling::Creature::AddVolatileScript(const std::string& name) {
|
|||
}
|
||||
|
||||
void Battling::Creature::AddVolatileScript(Script* script) { _volatile.Add(script); }
|
||||
void Battling::Creature::RemoveVolatileScript(const std::string& name) { _volatile.Remove(name); }
|
||||
void Battling::Creature::RemoveVolatileScript(const ConstString& name) { _volatile.Remove(name); }
|
||||
void Battling::Creature::RemoveVolatileScript(Battling::Script* script) { _volatile.Remove(script->GetName()); }
|
||||
void Battling::Creature::HasVolatileScript(const std::string& name) const { _volatile.Has(name); }
|
||||
void Battling::Creature::HasVolatileScript(const ConstString& name) const { _volatile.Has(name); }
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace CreatureLib::Battling {
|
|||
Script* _activeTalent = nullptr;
|
||||
|
||||
bool _hasOverridenTalent;
|
||||
std::string _overridenTalentName = "";
|
||||
ConstString _overridenTalentName = ""_cnc;
|
||||
std::unordered_set<Creature*> _seenOpponents = {};
|
||||
|
||||
std::vector<LearnedAttack*> _attacks;
|
||||
|
@ -98,7 +98,7 @@ namespace CreatureLib::Battling {
|
|||
bool IsOnBattleField() const { return _onBattleField; }
|
||||
|
||||
const std::string& GetNickname() const { return _nickname; }
|
||||
const std::string& GetActiveTalent() const;
|
||||
const ConstString& GetActiveTalent() const;
|
||||
|
||||
[[nodiscard]] bool IsFainted() const;
|
||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
|
||||
|
@ -108,7 +108,7 @@ namespace CreatureLib::Battling {
|
|||
void ChangeLevel(int8_t amount);
|
||||
void Damage(uint32_t damage, DamageSource source);
|
||||
void Heal(uint32_t amount);
|
||||
void OverrideActiveTalent(const std::string& talent);
|
||||
void OverrideActiveTalent(const ConstString& talent);
|
||||
void AddExperience(uint32_t amount);
|
||||
|
||||
void MarkOpponentAsSeen(Creature* creature) { _seenOpponents.insert(creature); }
|
||||
|
@ -116,11 +116,11 @@ namespace CreatureLib::Battling {
|
|||
|
||||
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override;
|
||||
void ClearVolatileScripts();
|
||||
void AddVolatileScript(const std::string& name);
|
||||
void AddVolatileScript(const ConstString& name);
|
||||
void AddVolatileScript(Script* script);
|
||||
void RemoveVolatileScript(const std::string& name);
|
||||
void RemoveVolatileScript(const ConstString& name);
|
||||
void RemoveVolatileScript(Script* script);
|
||||
void HasVolatileScript(const std::string& name) const;
|
||||
void HasVolatileScript(const ConstString& name) const;
|
||||
|
||||
std::vector<LearnedAttack*>& GetAttacks() { return _attacks; }
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace CreatureLib::Battling {
|
|||
virtual void Stack(){};
|
||||
virtual void OnRemove(){};
|
||||
|
||||
virtual const std::string& GetName() const = 0;
|
||||
virtual const ConstString& GetName() const = 0;
|
||||
|
||||
virtual void OnBeforeTurn(const BaseTurnChoice* choice){};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace CreatureLib::Battling {
|
|||
virtual ~ScriptResolver() = default;
|
||||
|
||||
virtual void Initialize(BattleLibrary* library){};
|
||||
virtual Script* LoadScript(ScriptCategory category, const std::string& scriptName) { return nullptr; };
|
||||
virtual Script* LoadScript(ScriptCategory category, const ConstString& scriptName) { return nullptr; };
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace CreatureLib::Battling {
|
||||
class ScriptSet {
|
||||
std::vector<Script*> _scripts;
|
||||
std::unordered_map<std::string, size_t> _lookup;
|
||||
std::unordered_map<ConstString, size_t> _lookup;
|
||||
|
||||
public:
|
||||
~ScriptSet() {
|
||||
|
@ -28,7 +28,7 @@ namespace CreatureLib::Battling {
|
|||
_lookup.insert({script->GetName(), _scripts.size() - 1});
|
||||
}
|
||||
|
||||
Script* Get(const std::string& key) const {
|
||||
Script* Get(const ConstString& key) const {
|
||||
auto f = _lookup.find(key);
|
||||
if (f != _lookup.end()) {
|
||||
return _scripts[f->second];
|
||||
|
@ -36,7 +36,7 @@ namespace CreatureLib::Battling {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Remove(const std::string& key) {
|
||||
void Remove(const ConstString& key) {
|
||||
auto find = _lookup.find(key);
|
||||
if (find != _lookup.end()) {
|
||||
auto script = _scripts[find->second];
|
||||
|
@ -55,7 +55,7 @@ namespace CreatureLib::Battling {
|
|||
_lookup.clear();
|
||||
}
|
||||
|
||||
bool Has(const std::string& key) const {
|
||||
bool Has(const ConstString& key) const {
|
||||
auto find = _lookup.find(key);
|
||||
return find != _lookup.end();
|
||||
}
|
||||
|
|
|
@ -2,18 +2,14 @@
|
|||
|
||||
using namespace CreatureLib::Library;
|
||||
|
||||
CreatureSpecies::CreatureSpecies(uint16_t id, const Arbutils::CaseInsensitiveConstString& name,
|
||||
const SpeciesVariant* defaultVariant, float genderRatio,
|
||||
const Arbutils::CaseInsensitiveConstString& growthRate, uint8_t captureRate)
|
||||
: _id(id), _genderRate(genderRatio), _growthRate(growthRate), _captureRate(captureRate),
|
||||
_variants({{"default"_cnc, defaultVariant}}), _name(name) {}
|
||||
CreatureSpecies::CreatureSpecies(uint16_t id, const ConstString& name, const SpeciesVariant* defaultVariant,
|
||||
float genderRatio, const ConstString& growthRate, uint8_t captureRate)
|
||||
: _name(name), _id(id), _genderRate(genderRatio), _growthRate(growthRate), _captureRate(captureRate),
|
||||
_variants({{"default"_cnc, defaultVariant}}) {}
|
||||
|
||||
bool CreatureSpecies::HasVariant(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||
return _variants.find(name) != _variants.end();
|
||||
}
|
||||
bool CreatureSpecies::HasVariant(const ConstString& name) const { return _variants.find(name) != _variants.end(); }
|
||||
|
||||
bool CreatureSpecies::TryGetVariant(const Arbutils::CaseInsensitiveConstString& name,
|
||||
const SpeciesVariant*& out) const {
|
||||
bool CreatureSpecies::TryGetVariant(const ConstString& name, const SpeciesVariant*& out) const {
|
||||
auto find = _variants.find(name);
|
||||
if (find != _variants.end()) {
|
||||
out = find->second;
|
||||
|
@ -22,12 +18,12 @@ bool CreatureSpecies::TryGetVariant(const Arbutils::CaseInsensitiveConstString&
|
|||
return false;
|
||||
}
|
||||
|
||||
const SpeciesVariant* CreatureSpecies::GetVariant(const Arbutils::CaseInsensitiveConstString& name) const {
|
||||
const SpeciesVariant* CreatureSpecies::GetVariant(const ConstString& name) const {
|
||||
auto key = name;
|
||||
return _variants.at(key);
|
||||
}
|
||||
|
||||
void CreatureSpecies::SetVariant(const Arbutils::CaseInsensitiveConstString& name, const SpeciesVariant* variant) {
|
||||
void CreatureSpecies::SetVariant(const ConstString& name, const SpeciesVariant* variant) {
|
||||
auto find = _variants.find(name);
|
||||
if (find != _variants.end()) {
|
||||
delete find->second;
|
||||
|
|
|
@ -7,25 +7,24 @@
|
|||
#include "../Gender.hpp"
|
||||
#include "SpeciesVariant.hpp"
|
||||
|
||||
using ConstString = Arbutils::CaseInsensitiveConstString;
|
||||
|
||||
namespace CreatureLib::Library {
|
||||
/*!
|
||||
\brief This holds the data required for a species of a creature, so the general data we can describe different
|
||||
creatures with.
|
||||
*/
|
||||
class CreatureSpecies {
|
||||
const ConstString _name;
|
||||
uint16_t _id;
|
||||
float _genderRate;
|
||||
const Arbutils::CaseInsensitiveConstString _growthRate;
|
||||
const ConstString _growthRate;
|
||||
uint8_t _captureRate;
|
||||
|
||||
private:
|
||||
std::unordered_map<Arbutils::CaseInsensitiveConstString, const SpeciesVariant*> _variants;
|
||||
Arbutils::CaseInsensitiveConstString _name;
|
||||
std::unordered_map<ConstString, const SpeciesVariant*> _variants;
|
||||
|
||||
public:
|
||||
CreatureSpecies(uint16_t id, const Arbutils::CaseInsensitiveConstString& name,
|
||||
const SpeciesVariant* defaultVariant, float genderRatio,
|
||||
const Arbutils::CaseInsensitiveConstString& growthRate, uint8_t captureRate);
|
||||
CreatureSpecies(uint16_t id, const ConstString& name, const SpeciesVariant* defaultVariant, float genderRatio,
|
||||
const ConstString& growthRate, uint8_t captureRate);
|
||||
|
||||
virtual ~CreatureSpecies() {
|
||||
for (auto v : _variants)
|
||||
|
@ -35,22 +34,18 @@ namespace CreatureLib::Library {
|
|||
|
||||
inline uint16_t GetId() const { return _id; }
|
||||
inline float GetGenderRate() const { return _genderRate; }
|
||||
inline const Arbutils::CaseInsensitiveConstString& GetGrowthRate() const { return _growthRate; }
|
||||
inline const ConstString& GetGrowthRate() const { return _growthRate; }
|
||||
inline uint8_t GetCaptureRate() const { return _captureRate; }
|
||||
|
||||
[[nodiscard]] bool HasVariant(const Arbutils::CaseInsensitiveConstString& key) const;
|
||||
[[nodiscard]] bool TryGetVariant(const Arbutils::CaseInsensitiveConstString& name,
|
||||
const SpeciesVariant*& out) const;
|
||||
[[nodiscard]] const SpeciesVariant* GetVariant(const Arbutils::CaseInsensitiveConstString& key) const;
|
||||
[[nodiscard]] bool HasVariant(const ConstString& key) const;
|
||||
[[nodiscard]] bool TryGetVariant(const ConstString& name, const SpeciesVariant*& out) const;
|
||||
[[nodiscard]] const SpeciesVariant* GetVariant(const ConstString& key) const;
|
||||
[[nodiscard]] Gender GetRandomGender(Arbutils::Random& rand) const;
|
||||
[[nodiscard]] const Arbutils::CaseInsensitiveConstString& GetName() const { return _name; }
|
||||
[[nodiscard]] const ConstString& GetName() const { return _name; }
|
||||
|
||||
void SetVariant(const Arbutils::CaseInsensitiveConstString& name, const SpeciesVariant* variant);
|
||||
void SetVariant(const ConstString& name, const SpeciesVariant* variant);
|
||||
|
||||
const std::unordered_map<Arbutils::CaseInsensitiveConstString, const SpeciesVariant*>&
|
||||
GetVariantsIterator() const {
|
||||
return _variants;
|
||||
}
|
||||
const std::unordered_map<ConstString, const SpeciesVariant*>& GetVariantsIterator() const { return _variants; }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ uint32_t CreatureLib::Library::SpeciesVariant::GetStatistic(CreatureLib::Core::S
|
|||
return _baseStatistics.GetStat(stat);
|
||||
}
|
||||
|
||||
const std::string& CreatureLib::Library::SpeciesVariant::GetTalent(int32_t index) const {
|
||||
const ConstString& CreatureLib::Library::SpeciesVariant::GetTalent(int32_t index) const {
|
||||
if (index < 0) {
|
||||
index = -index - 1;
|
||||
return _secretTalents[index];
|
||||
|
@ -20,10 +20,6 @@ const std::string& CreatureLib::Library::SpeciesVariant::GetTalent(int32_t index
|
|||
return _talents[index];
|
||||
}
|
||||
|
||||
/*const CreatureLib::Library::CreatureMoves *CreatureLib::Library::SpeciesVariant::GetCreatureMoves() const {
|
||||
return &_moves;
|
||||
}*/
|
||||
|
||||
int8_t CreatureLib::Library::SpeciesVariant::GetTalentIndex(const std::string& talent) const {
|
||||
auto i = std::find(_talents.begin(), _talents.end(), talent);
|
||||
if (i != _talents.end()) {
|
||||
|
@ -44,11 +40,11 @@ const CreatureLib::Library::LearnableAttacks* CreatureLib::Library::SpeciesVaria
|
|||
return _attacks;
|
||||
}
|
||||
|
||||
CreatureLib::Library::SpeciesVariant::SpeciesVariant(std::string name, float height, float weight,
|
||||
CreatureLib::Library::SpeciesVariant::SpeciesVariant(ConstString name, float height, float weight,
|
||||
uint32_t baseExperience, std::vector<uint8_t> types,
|
||||
CreatureLib::Core::StatisticSet<uint16_t> baseStats,
|
||||
std::vector<std::string> talents,
|
||||
std::vector<std::string> secretTalents,
|
||||
std::vector<ConstString> talents,
|
||||
std::vector<ConstString> secretTalents,
|
||||
const LearnableAttacks* attacks)
|
||||
: _name(std::move(name)), _height(height), _weight(weight), _baseExperience(baseExperience),
|
||||
_types(std::move(types)), _baseStatistics(baseStats), _talents(std::move(talents)),
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../Core/StatisticSet.hpp"
|
||||
#include "CreatureMoves.hpp"
|
||||
#include "LearnableAttacks.hpp"
|
||||
using ConstString = Arbutils::CaseInsensitiveConstString;
|
||||
|
||||
namespace CreatureLib::Library {
|
||||
/*!
|
||||
|
@ -14,7 +15,7 @@ namespace CreatureLib::Library {
|
|||
*/
|
||||
class SpeciesVariant {
|
||||
protected:
|
||||
std::string _name;
|
||||
ConstString _name;
|
||||
float _height;
|
||||
float _weight;
|
||||
uint32_t _baseExperience;
|
||||
|
@ -22,19 +23,19 @@ namespace CreatureLib::Library {
|
|||
private:
|
||||
std::vector<uint8_t> _types;
|
||||
const Core::StatisticSet<uint16_t> _baseStatistics;
|
||||
std::vector<std::string> _talents;
|
||||
std::vector<std::string> _secretTalents;
|
||||
std::vector<ConstString> _talents;
|
||||
std::vector<ConstString> _secretTalents;
|
||||
const LearnableAttacks* _attacks;
|
||||
|
||||
public:
|
||||
SpeciesVariant(std::string name, float height, float weight, uint32_t baseExperience,
|
||||
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience,
|
||||
std::vector<uint8_t> types, Core::StatisticSet<uint16_t> baseStats,
|
||||
std::vector<std::string> talents, std::vector<std::string> secretTalents,
|
||||
std::vector<ConstString> talents, std::vector<ConstString> secretTalents,
|
||||
const LearnableAttacks* attacks);
|
||||
|
||||
virtual ~SpeciesVariant();
|
||||
|
||||
inline const std::string& GetName() const { return _name; }
|
||||
inline const ConstString& GetName() const { return _name; }
|
||||
inline float GetHeight() const { return _height; }
|
||||
inline float GetWeight() const { return _weight; }
|
||||
inline uint32_t GetBaseExperience() const { return _baseExperience; }
|
||||
|
@ -43,12 +44,12 @@ namespace CreatureLib::Library {
|
|||
[[nodiscard]] uint8_t GetType(size_t index) const;
|
||||
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
|
||||
[[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const;
|
||||
[[nodiscard]] const std::string& GetTalent(int32_t index) const;
|
||||
[[nodiscard]] const ConstString& GetTalent(int32_t index) const;
|
||||
[[nodiscard]] const LearnableAttacks* GetLearnableAttacks() const;
|
||||
[[nodiscard]] int8_t GetTalentIndex(const std::string& talent) const;
|
||||
[[nodiscard]] int8_t GetRandomTalent(Arbutils::Random* rand) const;
|
||||
[[nodiscard]] inline const std::vector<std::string>& GetTalents() const { return _talents; }
|
||||
[[nodiscard]] inline const std::vector<std::string>& GetSecretTalents() const { return _secretTalents; }
|
||||
[[nodiscard]] inline const std::vector<ConstString>& GetTalents() const { return _talents; }
|
||||
[[nodiscard]] inline const std::vector<ConstString>& GetSecretTalents() const { return _secretTalents; }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ using namespace CreatureLib::Battling;
|
|||
|
||||
class TestScript : public Script {
|
||||
private:
|
||||
std::string _name;
|
||||
ConstString _name;
|
||||
|
||||
public:
|
||||
explicit TestScript(std::string name) : _name(std::move(name)){};
|
||||
const std::string& GetName() const override { return _name; }
|
||||
const ConstString& GetName() const override { return _name; }
|
||||
|
||||
void TestMethod(int& runCount) { runCount++; }
|
||||
};
|
||||
|
|
|
@ -9,11 +9,11 @@ using namespace CreatureLib::Battling;
|
|||
|
||||
class TestScript : public Script {
|
||||
private:
|
||||
std::string _name;
|
||||
ConstString _name;
|
||||
|
||||
public:
|
||||
explicit TestScript(std::string name) : _name(std::move(name)){};
|
||||
const std::string& GetName() const override { return _name; }
|
||||
const ConstString& GetName() const override { return _name; }
|
||||
};
|
||||
|
||||
TEST_CASE("Empty script set count == 0", "[Battling, Scripting]") {
|
||||
|
@ -64,7 +64,7 @@ TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
|
|||
auto s = new TestScript("foobar");
|
||||
set.Add(s);
|
||||
REQUIRE(set.Count() == 1);
|
||||
set.Remove("foobar");
|
||||
set.Remove("foobar"_cnc);
|
||||
REQUIRE(set.Count() == 0);
|
||||
auto it = set.GetIterator();
|
||||
REQUIRE(it->empty());
|
||||
|
@ -77,7 +77,7 @@ TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripti
|
|||
set.Add(s);
|
||||
set.Add(s2);
|
||||
REQUIRE(set.Count() == 2);
|
||||
set.Remove("foobar");
|
||||
set.Remove("foobar"_cnc);
|
||||
REQUIRE(set.Count() == 1);
|
||||
auto it = set.GetIterator();
|
||||
REQUIRE(it->at(0)->GetName() == "foobar2");
|
||||
|
|
|
@ -10,11 +10,11 @@ using namespace CreatureLib::Battling;
|
|||
|
||||
class TestScript : public Script {
|
||||
private:
|
||||
std::string _name;
|
||||
ConstString _name;
|
||||
|
||||
public:
|
||||
explicit TestScript(std::string name) : _name(std::move(name)){};
|
||||
const std::string& GetName() const override { return _name; }
|
||||
const ConstString& GetName() const override { return _name; }
|
||||
|
||||
void TestMethod(int& runCount) { runCount++; }
|
||||
};
|
||||
|
|
|
@ -24,9 +24,9 @@ SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
|||
auto l = new SpeciesLibrary();
|
||||
l->Insert("testSpecies1"_cnc,
|
||||
new CreatureSpecies(0, "testSpecies1"_cnc,
|
||||
new SpeciesVariant("default", 1, 1, 10, {0, 1},
|
||||
StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10), {"testTalent"},
|
||||
{"testSecretTalent"}, new LearnableAttacks(100)),
|
||||
new SpeciesVariant("default"_cnc, 1, 1, 10, {0, 1},
|
||||
StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10), {"testTalent"_cnc},
|
||||
{"testSecretTalent"_cnc}, new LearnableAttacks(100)),
|
||||
0.5f, "testGrowthRate"_cnc, 5));
|
||||
return l;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue