53 lines
3.0 KiB
C++
53 lines
3.0 KiB
C++
#include "../../src/Library/CreatureData/CreatureSpecies.hpp"
|
|
#define export extern "C"
|
|
|
|
export CreatureLib::Library::CreatureSpecies*
|
|
CreatureLib_CreatureSpecies_Construct(uint16_t id, const char* name,
|
|
CreatureLib::Library::SpeciesVariant* defaultVariant, float genderRatio,
|
|
const char* growthRate, uint8_t captureRate) {
|
|
return new CreatureLib::Library::CreatureSpecies(id, Arbutils::CaseInsensitiveConstString(name), defaultVariant,
|
|
genderRatio, Arbutils::CaseInsensitiveConstString(growthRate),
|
|
captureRate);
|
|
}
|
|
|
|
export void CreatureLib_CreatureSpecies_Destruct(const CreatureLib::Library::CreatureSpecies* p) { delete p; }
|
|
|
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
|
export returnType CreatureLib_##type##_##name(const CreatureLib::Library::type* p) { return p->name(); }
|
|
|
|
SIMPLE_GET_FUNC(CreatureSpecies, GetId, uint16_t);
|
|
SIMPLE_GET_FUNC(CreatureSpecies, GetGenderRate, float);
|
|
SIMPLE_GET_FUNC(CreatureSpecies, GetCaptureRate, uint8_t);
|
|
export const char* CreatureLib_CreatureSpecies_GetName(const CreatureLib::Library::CreatureSpecies* p) {
|
|
return p->GetName().c_str();
|
|
}
|
|
export const char* CreatureLib_CreatureSpecies_GetGrowthRate(const CreatureLib::Library::CreatureSpecies* p) {
|
|
return p->GetGrowthRate().c_str();
|
|
}
|
|
export bool CreatureLib_CreatureSpecies_HasVariant(const CreatureLib::Library::CreatureSpecies* p, const char* name) {
|
|
return p->HasVariant(Arbutils::CaseInsensitiveConstString::GetHash(name));
|
|
}
|
|
export bool CreatureLib_CreatureSpecies_HasVariantWithHash(const CreatureLib::Library::CreatureSpecies* p,
|
|
uint32_t hash) {
|
|
return p->HasVariant(hash);
|
|
}
|
|
export bool CreatureLib_CreatureSpecies_TryGetVariant(const CreatureLib::Library::CreatureSpecies* p, const char* name,
|
|
const CreatureLib::Library::SpeciesVariant* out) {
|
|
return p->TryGetVariant(Arbutils::CaseInsensitiveConstString::GetHash(name), out);
|
|
}
|
|
export bool CreatureLib_CreatureSpecies_TryGetVariantWithHash(const CreatureLib::Library::CreatureSpecies* p,
|
|
uint32_t hash,
|
|
const CreatureLib::Library::SpeciesVariant* out) {
|
|
return p->TryGetVariant(hash, out);
|
|
}
|
|
|
|
export const CreatureLib::Library::SpeciesVariant*
|
|
CreatureLib_CreatureSpecies_GetVariant(const CreatureLib::Library::CreatureSpecies* p, const char* name) {
|
|
return p->GetVariant(Arbutils::CaseInsensitiveConstString::GetHash(name));
|
|
}
|
|
export const CreatureLib::Library::SpeciesVariant*
|
|
CreatureLib_CreatureSpecies_GetVariantWithHash(const CreatureLib::Library::CreatureSpecies* p, uint32_t hash) {
|
|
return p->GetVariant(hash);
|
|
}
|
|
|
|
#undef SIMPLE_GET_FUNC |