Adds some documentation, add .clang-tidy file.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
94d1d68832
commit
15deae1504
|
@ -0,0 +1,11 @@
|
|||
Checks: 'readability-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,performance-*,cppcoreguidelines-*,
|
||||
bugprone-*,modernize-*,-modernize-use-trailing-return-type'
|
||||
HeaderFilterRegex: ''
|
||||
AnalyzeTemporaryDtors: false
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.ClassCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.PrivateMemberCase
|
||||
value: camelBack
|
||||
- key: readability-identifier-naming.PrivateMemberPrefix
|
||||
value: '_'
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef CREATURELIB_DEFINES_HPP
|
||||
#define CREATURELIB_DEFINES_HPP
|
||||
|
||||
typedef uint8_t level_int_t;
|
||||
using level_int_t = int;
|
||||
|
||||
#endif // CREATURELIB_DEFINES_HPP
|
||||
|
|
|
@ -16,12 +16,12 @@ namespace CreatureLib::Library {
|
|||
|
||||
public:
|
||||
impl(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience,
|
||||
const ArbUt::List<uint8_t>& types, Library::StatisticSet<uint16_t> baseStats,
|
||||
const ArbUt::List<ArbUt::StringView>& talents, const ArbUt::List<ArbUt::StringView>& secretTalents,
|
||||
ArbUt::List<uint8_t> types, Library::StatisticSet<uint16_t> baseStats,
|
||||
ArbUt::List<ArbUt::StringView> talents, ArbUt::List<ArbUt::StringView> secretTalents,
|
||||
const LearnableAttacks* attacks, std::unordered_set<uint32_t> flags)
|
||||
: _name(name), _height(height), _weight(weight), _baseExperience(baseExperience), _types((types)),
|
||||
_baseStatistics(baseStats), _talents(talents), _secretTalents(secretTalents), _attacks(attacks),
|
||||
_flags(flags){};
|
||||
: _name(name), _height(height), _weight(weight), _baseExperience(baseExperience),
|
||||
_types(std::move((types))), _baseStatistics(baseStats), _talents(std::move(talents)),
|
||||
_secretTalents(std::move(secretTalents)), _attacks(attacks), _flags(std::move(flags)){};
|
||||
|
||||
inline const ArbUt::StringView& GetName() const { return _name; }
|
||||
inline float GetHeight() const { return _height; }
|
||||
|
@ -39,13 +39,15 @@ namespace CreatureLib::Library {
|
|||
[[nodiscard]] const ArbUt::StringView& GetTalent(const TalentIndex& index) const {
|
||||
if (index.IsSecret() && _secretTalents.Count() > 0) {
|
||||
auto i = index.GetIndex();
|
||||
if (i > _secretTalents.Count())
|
||||
if (i > _secretTalents.Count()) {
|
||||
i = _secretTalents.Count();
|
||||
}
|
||||
return _secretTalents.At(i);
|
||||
}
|
||||
auto i = index.GetIndex();
|
||||
if (i > _talents.Count())
|
||||
if (i > _talents.Count()) {
|
||||
i = _talents.Count();
|
||||
}
|
||||
return _talents.At(i);
|
||||
}
|
||||
[[nodiscard]] TalentIndex GetTalentIndex(const ArbUt::StringView& talent) const {
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace CreatureLib::Library {
|
|||
struct impl;
|
||||
std::unique_ptr<impl> _impl;
|
||||
|
||||
protected:
|
||||
private:
|
||||
public:
|
||||
/// @brief Instantiate SpeciesVariant.
|
||||
/// @param name The unique name of the variant.
|
||||
|
|
|
@ -2,15 +2,25 @@
|
|||
#define CREATURELIB_TALENTINDEX_HPP
|
||||
|
||||
namespace CreatureLib::Library {
|
||||
/// @brief Stores the index of a talent on a creature. Defines whether or not the talent is secret, and what it's
|
||||
/// index is.
|
||||
class TalentIndex {
|
||||
bool _secret;
|
||||
uint8_t _index;
|
||||
|
||||
public:
|
||||
inline TalentIndex() noexcept : _secret(false), _index(0){};
|
||||
inline TalentIndex() noexcept : _index(0){};
|
||||
/// @brief Initialises a Talent Index from whether or not this is a secret talent, and it's index.
|
||||
/// @param secret Whether or not this is a secret talent.
|
||||
/// @param index The index of the talent on the species variant.
|
||||
inline TalentIndex(bool secret, uint8_t index) noexcept : _secret(secret), _index(index) {}
|
||||
constexpr inline bool IsSecret() const noexcept { return _secret; }
|
||||
constexpr inline bool GetIndex() const noexcept { return _index; }
|
||||
/// @brief Returns whether or not this is a secret talent.
|
||||
/// @return Whether or not this is a secret talent.
|
||||
[[nodiscard]] constexpr inline bool IsSecret() const noexcept { return _secret; }
|
||||
/// @brief Returns the index of the talent on the species variant.
|
||||
/// @return The index of the talent on the species variant.
|
||||
[[nodiscard]] constexpr inline uint8_t GetIndex() const noexcept { return _index; }
|
||||
|
||||
private:
|
||||
bool _secret = false;
|
||||
uint8_t _index;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue