diff --git a/CInterface/Library/NatureLibrary.cpp b/CInterface/Library/NatureLibrary.cpp index bc7b904..662174c 100644 --- a/CInterface/Library/NatureLibrary.cpp +++ b/CInterface/Library/NatureLibrary.cpp @@ -21,3 +21,8 @@ export uint8_t PkmnLib_NatureLibrary_GetRandomNatureName(NatureLibrary* p, ArbUt export uint8_t PkmnLib_NatureLibrary_GetNatureName(NatureLibrary* p, const Nature* nature, const char*& out) { Try(out = p->GetNatureName(nature).c_str()); } + +SIMPLE_GET_FUNC(NatureLibrary, GetNatureCount, size_t) +export uint8_t PkmnLib_NatureLibrary_GetNatureByIndex(NatureLibrary* p, size_t index, const char*& out) { + Try(out = p->GetNatureFromIndex(index).c_str();) +} \ No newline at end of file diff --git a/src/Library/Natures/NatureLibrary.hpp b/src/Library/Natures/NatureLibrary.hpp index 4719dcd..b807eed 100644 --- a/src/Library/Natures/NatureLibrary.hpp +++ b/src/Library/Natures/NatureLibrary.hpp @@ -42,6 +42,11 @@ namespace PkmnLib::Library { } throw CreatureException("Nature not found."); } + + size_t GetNatureCount() const noexcept { return _items.size(); } + inline const ArbUt::StringView& GetNatureFromIndex(size_t index) const { + return std::next(std::begin(_items), index)->first; + } }; }