Replace most collections with Arbutils collections for more safety.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-22 19:21:40 +01:00
parent f190121e74
commit 27288563cd
40 changed files with 234 additions and 226 deletions

View File

@@ -22,11 +22,11 @@ CreateCreature* CreateCreature::WithGender(Library::Gender gender) {
CreateCreature* CreateCreature::WithAttack(const Arbutils::CaseInsensitiveConstString& attackName,
AttackLearnMethod learnMethod) {
if (_attacks.size() >= _library->GetSettings()->GetMaximalMoves())
if (_attacks.Count() >= _library->GetSettings()->GetMaximalMoves())
throw CreatureException("You have already set the maximum amount of allowed moves.");
auto attackData = _library->GetAttackLibrary()->Get(attackName);
_attacks.emplace_back(attackData, learnMethod);
_attacks.Append(std::tuple(attackData, learnMethod));
return this;
}
@@ -56,8 +56,8 @@ Creature* CreateCreature::Create() {
}
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);
auto attacks = std::vector<LearnedAttack*>(_attacks.size());
for (size_t i = 0; i < attacks.size(); i++) {
auto attacks = List<LearnedAttack*>(_attacks.Count());
for (size_t i = 0; i < attacks.Count(); i++) {
auto kv = _attacks[i];
attacks[i] = new LearnedAttack(std::get<0>(kv), std::get<1>(kv));
}