PkmnLib/CInterface/Library/PokemonSpecies.cpp

29 lines
1.5 KiB
C++
Raw Normal View History

2020-04-16 13:04:53 +00:00
#include "../../src/Library/Species/PokemonSpecies.hpp"
#include "../Core.hpp"
using namespace PkmnLib::Library;
export const PokemonSpecies* PkmnLib_PokemonSpecies_Construct(uint16_t id, const char* name,
const PokemonForme* defaultForme, float genderRatio,
const char* growthRate, uint8_t captureRate,
uint8_t baseHappiness) {
auto cName = Arbutils::CaseInsensitiveConstString(name);
auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate);
return new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);
}
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }
#define SIMPLE_GET_FUNC(type, name, returnType) \
export returnType PkmnLib_##type##_##name(const PkmnLib::Library::type* p) { return p->name(); }
SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t);
#undef SIMPLE_GET_FUNC
export void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); }
export size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); }
export uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, const EvolutionData*& out) {
Try(out = p->GetEvolutions().At(index));
}