Added Creature C Interface, misc fixes and changes for Creature.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -12,7 +12,8 @@ uint32_t CreatureLib::Library::SpeciesVariant::GetStatistic(CreatureLib::Core::S
|
||||
return _baseStatistics.GetStat(stat);
|
||||
}
|
||||
|
||||
const TalentIndex CreatureLib::Library::SpeciesVariant::GetTalentIndex(const ConstString& talent) const {
|
||||
const CreatureLib::Library::TalentIndex
|
||||
CreatureLib::Library::SpeciesVariant::GetTalentIndex(const ConstString& talent) const {
|
||||
for (size_t i = 0; i < _talents.size(); i++) {
|
||||
if (_talents.at(i) == talent) {
|
||||
return TalentIndex(false, i);
|
||||
@@ -26,7 +27,7 @@ const TalentIndex CreatureLib::Library::SpeciesVariant::GetTalentIndex(const Con
|
||||
throw CreatureException("The given talent is not a valid talent for this creature.");
|
||||
}
|
||||
|
||||
TalentIndex CreatureLib::Library::SpeciesVariant::GetRandomTalent(Arbutils::Random* rand) const {
|
||||
CreatureLib::Library::TalentIndex CreatureLib::Library::SpeciesVariant::GetRandomTalent(Arbutils::Random* rand) const {
|
||||
return TalentIndex(false, rand->Get(_talents.size()));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
#define CREATURELIB_TALENTINDEX_HPP
|
||||
|
||||
#include <cstdint>
|
||||
class TalentIndex {
|
||||
bool _secret;
|
||||
uint8_t _index;
|
||||
namespace CreatureLib::Library {
|
||||
class TalentIndex {
|
||||
bool _secret;
|
||||
uint8_t _index;
|
||||
|
||||
public:
|
||||
TalentIndex() : _secret(false), _index(0){};
|
||||
TalentIndex(bool secret, uint8_t index) : _secret(secret), _index(index) {}
|
||||
constexpr inline bool IsSecret() const { return _secret; }
|
||||
constexpr inline bool GetIndex() const { return _index; }
|
||||
};
|
||||
public:
|
||||
TalentIndex() : _secret(false), _index(0){};
|
||||
TalentIndex(bool secret, uint8_t index) : _secret(secret), _index(index) {}
|
||||
constexpr inline bool IsSecret() const { return _secret; }
|
||||
constexpr inline bool GetIndex() const { return _index; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CREATURELIB_TALENTINDEX_HPP
|
||||
|
||||
Reference in New Issue
Block a user