PkmnLib/CInterface/Library/NatureLibrary.cpp

28 lines
1.2 KiB
C++
Raw Normal View History

2020-04-17 18:03:01 +00:00
#include "../../src/Library/Natures/NatureLibrary.hpp"
#include "../Core.hpp"
using namespace PkmnLib::Library;
2022-04-02 11:03:11 +00:00
export_func NatureLibrary* PkmnLib_NatureLibrary_Construct(size_t initialCapacity) {
2020-04-17 18:03:01 +00:00
return new NatureLibrary(initialCapacity);
}
2022-04-02 11:03:11 +00:00
export_func void PkmnLib_NatureLibrary_Destruct(const NatureLibrary* p) { delete p; }
2020-04-17 18:03:01 +00:00
2022-04-02 11:03:11 +00:00
export_func uint8_t PkmnLib_NatureLibrary_LoadNature(NatureLibrary* p, const char* name, const Nature* nature) {
2020-07-04 13:50:30 +00:00
Try(p->LoadNature(ArbUt::StringView(name), nature);)
2020-04-17 18:03:01 +00:00
}
2022-04-02 11:03:11 +00:00
export_func uint8_t PkmnLib_NatureLibrary_GetNatureByName(NatureLibrary* p, const char* name, const Nature*& out) {
2020-07-04 13:50:30 +00:00
Try(out = p->GetNatureByName(ArbUt::StringView(name)).GetRaw());
2020-04-17 18:03:01 +00:00
}
2022-04-02 11:03:11 +00:00
export_func uint8_t PkmnLib_NatureLibrary_GetRandomNatureName(NatureLibrary* p, ArbUt::Random* rand, const char*& out) {
Try(out = p->GetRandomNatureName(*rand).c_str();)
2020-04-17 18:03:01 +00:00
}
2022-04-02 11:03:11 +00:00
export_func uint8_t PkmnLib_NatureLibrary_GetNatureName(NatureLibrary* p, const Nature* nature, const char*& out) {
2020-04-17 18:03:01 +00:00
Try(out = p->GetNatureName(nature).c_str());
}
SIMPLE_GET_FUNC(NatureLibrary, GetNatureCount, size_t)
2022-04-02 11:03:11 +00:00
export_func uint8_t PkmnLib_NatureLibrary_GetNatureByIndex(NatureLibrary* p, size_t index, const char*& out) {
Try(out = p->GetNatureFromIndex(index).c_str();)
}