Remove Random passes by pointer.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
abab1d0f9a
commit
5032377554
|
@ -35,7 +35,7 @@ Creature* CreateCreature::Create() {
|
||||||
auto variant = species->GetVariant(this->_variant);
|
auto variant = species->GetVariant(this->_variant);
|
||||||
Library::TalentIndex talent;
|
Library::TalentIndex talent;
|
||||||
if (this->_talent.Empty()) {
|
if (this->_talent.Empty()) {
|
||||||
talent = variant->GetRandomTalent(&rand);
|
talent = variant->GetRandomTalent(rand);
|
||||||
} else {
|
} else {
|
||||||
talent = variant->GetTalentIndex(this->_talent);
|
talent = variant->GetTalentIndex(this->_talent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,14 +86,10 @@ namespace CreatureLib::Library {
|
||||||
|
|
||||||
[[nodiscard]] size_t GetCount() const noexcept { return _values.Count(); }
|
[[nodiscard]] size_t GetCount() const noexcept { return _values.Count(); }
|
||||||
|
|
||||||
inline ArbUt::BorrowedPtr<const T> GetRandomValue(ArbUt::Random rand = ArbUt::Random()) const noexcept {
|
inline ArbUt::BorrowedPtr<const T> GetRandomValue(ArbUt::Random& rand) const noexcept {
|
||||||
auto i = rand.Get(_listValues.Count());
|
auto i = rand.Get(_listValues.Count());
|
||||||
return _values[_listValues[i]];
|
return _values[_listValues[i]];
|
||||||
}
|
}
|
||||||
inline ArbUt::BorrowedPtr<const T> GetRandomValue(ArbUt::Random* rand) const noexcept {
|
|
||||||
auto i = rand->Get(_listValues.Count());
|
|
||||||
return _values[_listValues[i]];
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ namespace CreatureLib::Library {
|
||||||
GetLearnableAttacks() const {
|
GetLearnableAttacks() const {
|
||||||
return _attacks;
|
return _attacks;
|
||||||
}
|
}
|
||||||
[[nodiscard]] inline TalentIndex GetRandomTalent(ArbUt::Random* rand) const noexcept {
|
[[nodiscard]] inline TalentIndex GetRandomTalent(ArbUt::Random& rand) const noexcept {
|
||||||
return TalentIndex(false, rand->Get(_talents.Count()));
|
return TalentIndex(false, rand.Get(_talents.Count()));
|
||||||
}
|
}
|
||||||
[[nodiscard]] inline const ArbUt::List<ArbUt::StringView>& GetTalents() const { return _talents; }
|
[[nodiscard]] inline const ArbUt::List<ArbUt::StringView>& GetTalents() const { return _talents; }
|
||||||
[[nodiscard]] inline const ArbUt::List<ArbUt::StringView>& GetSecretTalents() const { return _secretTalents; }
|
[[nodiscard]] inline const ArbUt::List<ArbUt::StringView>& GetSecretTalents() const { return _secretTalents; }
|
||||||
|
|
Loading…
Reference in New Issue