2020-02-29 16:00:29 +00:00
|
|
|
#include "../../src/Library/CreatureData/CreatureSpecies.hpp"
|
2020-03-25 18:07:36 +00:00
|
|
|
#include "../Core.hpp"
|
2020-02-29 16:21:36 +00:00
|
|
|
using namespace CreatureLib::Library;
|
2020-02-29 16:00:29 +00:00
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_CreatureSpecies_Construct(CreatureSpecies*& out, uint16_t id, const char* name,
|
|
|
|
SpeciesVariant* defaultVariant, float genderRatio,
|
|
|
|
const char* growthRate, uint8_t captureRate) {
|
|
|
|
|
|
|
|
Try(out = new CreatureSpecies(id, Arbutils::CaseInsensitiveConstString(name), defaultVariant, genderRatio,
|
|
|
|
Arbutils::CaseInsensitiveConstString(growthRate), captureRate);)
|
2020-02-29 16:00:29 +00:00
|
|
|
}
|
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export void CreatureLib_CreatureSpecies_Destruct(const CreatureSpecies* p) { delete p; }
|
2020-02-29 16:00:29 +00:00
|
|
|
|
|
|
|
#define SIMPLE_GET_FUNC(type, name, returnType) \
|
2020-02-29 16:21:36 +00:00
|
|
|
export returnType CreatureLib_##type##_##name(const type* p) { return p->name(); }
|
2020-02-29 16:00:29 +00:00
|
|
|
|
|
|
|
SIMPLE_GET_FUNC(CreatureSpecies, GetId, uint16_t);
|
|
|
|
SIMPLE_GET_FUNC(CreatureSpecies, GetGenderRate, float);
|
|
|
|
SIMPLE_GET_FUNC(CreatureSpecies, GetCaptureRate, uint8_t);
|
2020-02-29 16:21:36 +00:00
|
|
|
export const char* CreatureLib_CreatureSpecies_GetName(const CreatureSpecies* p) { return p->GetName().c_str(); }
|
|
|
|
export const char* CreatureLib_CreatureSpecies_GetGrowthRate(const CreatureSpecies* p) {
|
2020-02-29 16:00:29 +00:00
|
|
|
return p->GetGrowthRate().c_str();
|
|
|
|
}
|
2020-02-29 16:21:36 +00:00
|
|
|
export bool CreatureLib_CreatureSpecies_HasVariant(const CreatureSpecies* p, const char* name) {
|
2020-02-29 16:00:29 +00:00
|
|
|
return p->HasVariant(Arbutils::CaseInsensitiveConstString::GetHash(name));
|
|
|
|
}
|
2020-02-29 16:21:36 +00:00
|
|
|
export bool CreatureLib_CreatureSpecies_HasVariantWithHash(const CreatureSpecies* p, uint32_t hash) {
|
2020-02-29 16:00:29 +00:00
|
|
|
return p->HasVariant(hash);
|
|
|
|
}
|
2020-02-29 16:21:36 +00:00
|
|
|
export bool CreatureLib_CreatureSpecies_TryGetVariant(const CreatureSpecies* p, const char* name,
|
2020-03-25 18:07:36 +00:00
|
|
|
const SpeciesVariant*& out) {
|
2020-02-29 16:00:29 +00:00
|
|
|
return p->TryGetVariant(Arbutils::CaseInsensitiveConstString::GetHash(name), out);
|
|
|
|
}
|
2020-02-29 16:21:36 +00:00
|
|
|
export bool CreatureLib_CreatureSpecies_TryGetVariantWithHash(const CreatureSpecies* p, uint32_t hash,
|
|
|
|
const SpeciesVariant* out) {
|
2020-02-29 16:00:29 +00:00
|
|
|
return p->TryGetVariant(hash, out);
|
|
|
|
}
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_CreatureSpecies_GetVariant(const SpeciesVariant*& out, const CreatureSpecies* p,
|
|
|
|
const char* name) {
|
|
|
|
Try(out = p->GetVariant(Arbutils::CaseInsensitiveConstString::GetHash(name));)
|
2020-02-29 16:00:29 +00:00
|
|
|
}
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_CreatureSpecies_GetVariantWithHash(const SpeciesVariant* out, const CreatureSpecies* p,
|
|
|
|
uint32_t hash) {
|
|
|
|
Try(out = p->GetVariant(hash);)
|
2020-02-29 16:00:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef SIMPLE_GET_FUNC
|