Fully documents CreatureSpecies.

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2020-09-25 18:52:47 +02:00
parent 54eb0da76a
commit 6189919496
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 21 additions and 1 deletions

View File

@ -32,6 +32,9 @@ namespace CreatureLib::Library {
/// @brief Returns the unique id of the creature species.
/// @return The unique id of the creature species
uint16_t GetId() const noexcept;
/// @brief Returns the name of the species.
/// @return The name of the species.
[[nodiscard]] const ArbUt::StringView& GetName() const noexcept;
/// @brief Returns the gender rate of the creature species.
/// @return The gender rate of the creature species. 0 is always female, 1 is always male. -1 makes the creature
/// genderless.
@ -65,15 +68,32 @@ namespace CreatureLib::Library {
/// @param out If a variant is found, it will be put in this variable. If not, this will remain unchanged.
/// @return True if the species contains the variant, false otherwise.
[[nodiscard]] bool TryGetVariant(uint32_t hash, ArbUt::BorrowedPtr<const SpeciesVariant>& out) const noexcept;
/// @brief Returns a variant with a specific name. Throws if no variant with the name exists.
/// @param key The name of the variant that's being looked for.
/// @return The specified variant.
[[nodiscard]] ArbUt::BorrowedPtr<const SpeciesVariant> GetVariant(const ArbUt::BasicStringView& key) const;
/// @brief Returns a variant with a specific name. Throws if no variant with the name exists.
/// @param key The string hash of the variant that's being looked for.
/// @return The specified variant.
[[nodiscard]] ArbUt::BorrowedPtr<const SpeciesVariant> GetVariant(uint32_t key) const;
/// @brief Returns a random gender based on the gender ratio of the species.
/// @param rand A random number generator class.
/// @return A random gender. If gender ratio is -1 this will return Genderless, otherwise it will be either male
/// or female.
[[nodiscard]] Gender GetRandomGender(ArbUt::Random& rand) const noexcept;
[[nodiscard]] const ArbUt::StringView& GetName() const noexcept;
/// @brief Appends a variant to the species.
/// @param name The unique name of the new variant.
/// @param variant The new variant to add.
void SetVariant(const ArbUt::StringView& name, const SpeciesVariant* variant);
/// @brief Returns a list of variants of the species.
/// @return A list of variants of the species.
const ArbUt::List<ArbUt::BorrowedPtr<const SpeciesVariant>>& GetVariantsIterator() const;
/// @brief Checks whether the species has a specific flag.
/// @param key The flag to check for.
/// @return True if the species has the flag, false otherwise.
bool HasFlag(const ArbUt::StringView& key) const noexcept;
bool HasFlag(uint32_t keyHash) const noexcept;
};