Fixes talent exception when changing to a variant with fewer talents
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
851cb11f11
commit
b003e13f2c
|
@ -39,17 +39,17 @@ namespace CreatureLib::Library {
|
|||
[[nodiscard]] inline size_t GetSecretTalentCount() const noexcept { return _secretTalents.Count(); }
|
||||
[[nodiscard]] const ArbUt::BorrowedPtr<const Talent>& GetTalent(const TalentIndex& index) const {
|
||||
if (index.IsSecret() && _secretTalents.Count() > 0) {
|
||||
auto i = index.GetIndex();
|
||||
if (i > _secretTalents.Count()) {
|
||||
i = _secretTalents.Count();
|
||||
auto usedIndex = index.GetIndex();
|
||||
if (usedIndex >= _secretTalents.Count()) {
|
||||
usedIndex = _secretTalents.Count() - 1;
|
||||
}
|
||||
return _secretTalents.At(i);
|
||||
return _secretTalents.At(usedIndex);
|
||||
}
|
||||
auto i = index.GetIndex();
|
||||
if (i > _talents.Count()) {
|
||||
i = _talents.Count();
|
||||
auto usedIndex = index.GetIndex();
|
||||
if (usedIndex >= _talents.Count()) {
|
||||
usedIndex = _talents.Count() - 1;
|
||||
}
|
||||
return _talents.At(i);
|
||||
return _talents.At(usedIndex);
|
||||
}
|
||||
[[nodiscard]] TalentIndex GetTalentIndex(const ArbUt::BorrowedPtr<Talent>& talent) const {
|
||||
for (size_t i = 0; i < _talents.Count(); i++) {
|
||||
|
|
Loading…
Reference in New Issue