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

@@ -1,14 +1,15 @@
#ifndef CREATURELIB_SPECIESVARIANT_HPP
#define CREATURELIB_SPECIESVARIANT_HPP
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Random.hpp>
#include <string>
#include <vector>
#include "../StatisticSet.hpp"
#include "CreatureMoves.hpp"
#include "LearnableAttacks.hpp"
#include "TalentIndex.hpp"
using ConstString = Arbutils::CaseInsensitiveConstString;
using namespace Arbutils::Collections;
namespace CreatureLib::Library {
/*!
@@ -22,17 +23,16 @@ namespace CreatureLib::Library {
uint32_t _baseExperience;
private:
std::vector<uint8_t> _types;
List<uint8_t> _types;
Library::StatisticSet<uint16_t> _baseStatistics;
std::vector<ConstString> _talents;
std::vector<ConstString> _secretTalents;
List<ConstString> _talents;
List<ConstString> _secretTalents;
const LearnableAttacks* _attacks;
public:
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience,
std::vector<uint8_t> types, Library::StatisticSet<uint16_t> baseStats,
std::vector<ConstString> talents, std::vector<ConstString> secretTalents,
const LearnableAttacks* attacks);
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience, List<uint8_t> types,
Library::StatisticSet<uint16_t> baseStats, List<ConstString> talents,
List<ConstString> secretTalents, const LearnableAttacks* attacks);
virtual ~SpeciesVariant();
@@ -43,21 +43,21 @@ namespace CreatureLib::Library {
[[nodiscard]] size_t GetTypeCount() const;
[[nodiscard]] uint8_t GetType(size_t index) const;
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
[[nodiscard]] const List<uint8_t>& GetTypes() const;
[[nodiscard]] uint32_t GetStatistic(Library::Statistic stat) const;
[[nodiscard]] const size_t GetTalentCount() const { return _talents.size(); }
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.size(); }
[[nodiscard]] const size_t GetTalentCount() const { return _talents.Count(); }
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.Count(); }
[[nodiscard]] const ConstString& GetTalent(const TalentIndex& index) const {
if (index.IsSecret())
return _secretTalents.at(index.GetIndex());
return _talents.at(index.GetIndex());
return _secretTalents.At(index.GetIndex());
return _talents.At(index.GetIndex());
}
[[nodiscard]] const TalentIndex GetTalentIndex(const ConstString& talent) const;
[[nodiscard]] const LearnableAttacks* GetLearnableAttacks() const;
[[nodiscard]] TalentIndex GetRandomTalent(Arbutils::Random* rand) const;
[[nodiscard]] inline const std::vector<ConstString>& GetTalents() const { return _talents; }
[[nodiscard]] inline const std::vector<ConstString>& GetSecretTalents() const { return _secretTalents; }
[[nodiscard]] inline const List<ConstString>& GetTalents() const { return _talents; }
[[nodiscard]] inline const List<ConstString>& GetSecretTalents() const { return _secretTalents; }
};
}