Deal with talent indices that are out of bounds.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
fccf339e76
commit
637649c993
|
@ -47,9 +47,16 @@ namespace CreatureLib::Library {
|
||||||
[[nodiscard]] const size_t GetTalentCount() const { return _talents.Count(); }
|
[[nodiscard]] const size_t GetTalentCount() const { return _talents.Count(); }
|
||||||
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.Count(); }
|
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.Count(); }
|
||||||
[[nodiscard]] const ArbUt::CaseInsensitiveConstString& GetTalent(const TalentIndex& index) const {
|
[[nodiscard]] const ArbUt::CaseInsensitiveConstString& GetTalent(const TalentIndex& index) const {
|
||||||
if (index.IsSecret())
|
if (index.IsSecret() && _secretTalents.Count() > 0) {
|
||||||
return _secretTalents.At(index.GetIndex());
|
auto i = index.GetIndex();
|
||||||
return _talents.At(index.GetIndex());
|
if (i > _secretTalents.Count())
|
||||||
|
i = _secretTalents.Count();
|
||||||
|
return _secretTalents.At(i);
|
||||||
|
}
|
||||||
|
auto i = index.GetIndex();
|
||||||
|
if (i > _talents.Count())
|
||||||
|
i = _talents.Count();
|
||||||
|
return _talents.At(i);
|
||||||
}
|
}
|
||||||
[[nodiscard]] const TalentIndex GetTalentIndex(const ArbUt::CaseInsensitiveConstString& talent) const;
|
[[nodiscard]] const TalentIndex GetTalentIndex(const ArbUt::CaseInsensitiveConstString& talent) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue