Mark LearnableAttacks on SpeciesVariant as unique.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
214ff81992
commit
aee5bcb088
|
@ -46,6 +46,8 @@ SIMPLE_GET_FUNC(SpeciesVariant, GetSecretTalentCount, size_t);
|
||||||
export uint8_t CreatureLib_SpeciesVariant_GetTalent(SpeciesVariant* p, bool secret, uint8_t index) {
|
export uint8_t CreatureLib_SpeciesVariant_GetTalent(SpeciesVariant* p, bool secret, uint8_t index) {
|
||||||
return p->GetTalent(TalentIndex(secret, index));
|
return p->GetTalent(TalentIndex(secret, index));
|
||||||
}
|
}
|
||||||
SIMPLE_GET_FUNC(SpeciesVariant, GetLearnableAttacks, const LearnableAttacks*);
|
export const LearnableAttacks* CreatureLib_SpeciesVariant_GetLearnableAttacks(SpeciesVariant* p) {
|
||||||
|
return p->GetLearnableAttacks().get();
|
||||||
|
}
|
||||||
|
|
||||||
#undef SIMPLE_GET_FUNC
|
#undef SIMPLE_GET_FUNC
|
||||||
|
|
|
@ -31,7 +31,8 @@ CreatureLib::Library::TalentIndex CreatureLib::Library::SpeciesVariant::GetRando
|
||||||
return TalentIndex(false, rand->Get(_talents.Count()));
|
return TalentIndex(false, rand->Get(_talents.Count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const CreatureLib::Library::LearnableAttacks* CreatureLib::Library::SpeciesVariant::GetLearnableAttacks() const {
|
const std::unique_ptr<const CreatureLib::Library::LearnableAttacks>&
|
||||||
|
CreatureLib::Library::SpeciesVariant::GetLearnableAttacks() const {
|
||||||
return _attacks;
|
return _attacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,5 +44,3 @@ CreatureLib::Library::SpeciesVariant::SpeciesVariant(ConstString name, float hei
|
||||||
: _name(std::move(name)), _height(height), _weight(weight), _baseExperience(baseExperience),
|
: _name(std::move(name)), _height(height), _weight(weight), _baseExperience(baseExperience),
|
||||||
_types(std::move(types)), _baseStatistics(baseStats), _talents(std::move(talents)),
|
_types(std::move(types)), _baseStatistics(baseStats), _talents(std::move(talents)),
|
||||||
_secretTalents(std::move(secretTalents)), _attacks(attacks) {}
|
_secretTalents(std::move(secretTalents)), _attacks(attacks) {}
|
||||||
|
|
||||||
CreatureLib::Library::SpeciesVariant::~SpeciesVariant() { delete _attacks; }
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <Arbutils/Collections/List.hpp>
|
#include <Arbutils/Collections/List.hpp>
|
||||||
#include <Arbutils/Random.hpp>
|
#include <Arbutils/Random.hpp>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../StatisticSet.hpp"
|
#include "../StatisticSet.hpp"
|
||||||
#include "CreatureMoves.hpp"
|
#include "CreatureMoves.hpp"
|
||||||
|
@ -27,14 +28,14 @@ namespace CreatureLib::Library {
|
||||||
Library::StatisticSet<uint16_t> _baseStatistics;
|
Library::StatisticSet<uint16_t> _baseStatistics;
|
||||||
List<ConstString> _talents;
|
List<ConstString> _talents;
|
||||||
List<ConstString> _secretTalents;
|
List<ConstString> _secretTalents;
|
||||||
const LearnableAttacks* _attacks;
|
std::unique_ptr<const LearnableAttacks> _attacks;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience, List<uint8_t> types,
|
SpeciesVariant(ConstString name, float height, float weight, uint32_t baseExperience, List<uint8_t> types,
|
||||||
Library::StatisticSet<uint16_t> baseStats, List<ConstString> talents,
|
Library::StatisticSet<uint16_t> baseStats, List<ConstString> talents,
|
||||||
List<ConstString> secretTalents, const LearnableAttacks* attacks);
|
List<ConstString> secretTalents, const LearnableAttacks* attacks);
|
||||||
|
|
||||||
virtual ~SpeciesVariant();
|
virtual ~SpeciesVariant() = default;
|
||||||
|
|
||||||
inline const ConstString& GetName() const { return _name; }
|
inline const ConstString& GetName() const { return _name; }
|
||||||
inline float GetHeight() const { return _height; }
|
inline float GetHeight() const { return _height; }
|
||||||
|
@ -54,7 +55,7 @@ namespace CreatureLib::Library {
|
||||||
}
|
}
|
||||||
[[nodiscard]] const TalentIndex GetTalentIndex(const ConstString& talent) const;
|
[[nodiscard]] const TalentIndex GetTalentIndex(const ConstString& talent) const;
|
||||||
|
|
||||||
[[nodiscard]] const LearnableAttacks* GetLearnableAttacks() const;
|
[[nodiscard]] const std::unique_ptr<const CreatureLib::Library::LearnableAttacks>& GetLearnableAttacks() const;
|
||||||
[[nodiscard]] TalentIndex GetRandomTalent(Arbutils::Random* rand) const;
|
[[nodiscard]] TalentIndex GetRandomTalent(Arbutils::Random* rand) const;
|
||||||
[[nodiscard]] inline const List<ConstString>& GetTalents() const { return _talents; }
|
[[nodiscard]] inline const List<ConstString>& GetTalents() const { return _talents; }
|
||||||
[[nodiscard]] inline const List<ConstString>& GetSecretTalents() const { return _secretTalents; }
|
[[nodiscard]] inline const List<ConstString>& GetSecretTalents() const { return _secretTalents; }
|
||||||
|
|
Loading…
Reference in New Issue