Used ClangFormat style guide I'm happy with.
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:
@@ -2,30 +2,19 @@
|
||||
|
||||
using namespace CreatureLib::Library;
|
||||
|
||||
CreatureSpecies::CreatureSpecies(uint16_t id, std::string name, const SpeciesVariant* defaultVariant,
|
||||
float genderRatio, std::string growthRate, uint8_t captureRate, uint8_t baseHappiness)
|
||||
:
|
||||
__Id(id),
|
||||
__GenderRate(genderRatio),
|
||||
__GrowthRate(std::move(growthRate)),
|
||||
__CaptureRate(captureRate),
|
||||
__BaseHappiness(baseHappiness),
|
||||
_variants({{"default", defaultVariant}}),
|
||||
_name(std::move(name))
|
||||
{}
|
||||
CreatureSpecies::CreatureSpecies(uint16_t id, std::string name, const SpeciesVariant* defaultVariant, float genderRatio,
|
||||
std::string growthRate, uint8_t captureRate, uint8_t baseHappiness)
|
||||
: __Id(id), __GenderRate(genderRatio), __GrowthRate(std::move(growthRate)), __CaptureRate(captureRate),
|
||||
__BaseHappiness(baseHappiness), _variants({{"default", defaultVariant}}), _name(std::move(name)) {}
|
||||
|
||||
const SpeciesVariant *CreatureSpecies::GetVariant(const std::string& key) const {
|
||||
return _variants.at(key);
|
||||
}
|
||||
const SpeciesVariant* CreatureSpecies::GetVariant(const std::string& key) const { return _variants.at(key); }
|
||||
|
||||
Gender CreatureSpecies::GetRandomGender(CreatureLib::Core::Random &rand) const {
|
||||
Gender CreatureSpecies::GetRandomGender(CreatureLib::Core::Random& rand) const {
|
||||
// TODO: Genderless creatures
|
||||
auto val = rand.GetDouble();
|
||||
if (val >= this->__GenderRate) return Gender ::Female;
|
||||
if (val >= this->__GenderRate)
|
||||
return Gender ::Female;
|
||||
return Gender ::Male;
|
||||
}
|
||||
|
||||
const std::string &CreatureSpecies::GetName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
const std::string& CreatureSpecies::GetName() const { return _name; }
|
||||
|
||||
Reference in New Issue
Block a user