38 lines
1.8 KiB
C++
38 lines
1.8 KiB
C++
|
#include "../../src/Library/TypeLibrary.hpp"
|
||
|
#define export extern "C"
|
||
|
|
||
|
export CreatureLib::Library::TypeLibrary* CreatureLib_TypeLibrary_Construct(size_t initialCapacity) {
|
||
|
return new CreatureLib::Library::TypeLibrary(initialCapacity);
|
||
|
};
|
||
|
|
||
|
export void CreatureLib_TypeLibrary_Destruct(const CreatureLib::Library::TypeLibrary* p) { delete p; }
|
||
|
|
||
|
export uint8_t CreatureLib_TypeLibrary_GetTypeId(const CreatureLib::Library::TypeLibrary* p, const char* type) {
|
||
|
return p->GetTypeId(Arbutils::CaseInsensitiveConstString::GetHash(type));
|
||
|
}
|
||
|
export uint8_t CreatureLib_TypeLibrary_GetTypeIdWithHash(const CreatureLib::Library::TypeLibrary* p, uint32_t type) {
|
||
|
return p->GetTypeId(type);
|
||
|
}
|
||
|
|
||
|
export uint8_t CreatureLib_TypeLibrary_RegisterType(CreatureLib::Library::TypeLibrary* p, const char* type) {
|
||
|
return p->RegisterType(Arbutils::CaseInsensitiveConstString::GetHash(type));
|
||
|
}
|
||
|
export uint8_t CreatureLib_TypeLibrary_RegisterTypeWithHash(CreatureLib::Library::TypeLibrary* p, uint32_t type) {
|
||
|
return p->RegisterType(type);
|
||
|
}
|
||
|
|
||
|
export void CreatureLib_TypeLibrary_SetEffectiveness(CreatureLib::Library::TypeLibrary* p, uint8_t attacking,
|
||
|
uint8_t defensive, float effectiveness) {
|
||
|
p->SetEffectiveness(attacking, defensive, effectiveness);
|
||
|
}
|
||
|
|
||
|
export float CreatureLib_TypeLibrary_GetSingleEffectiveness(CreatureLib::Library::TypeLibrary* p, uint8_t attacking,
|
||
|
uint8_t defensive) {
|
||
|
return p->GetSingleEffectiveness(attacking, defensive);
|
||
|
}
|
||
|
|
||
|
export float CreatureLib_TypeLibrary_GetEffectiveness(CreatureLib::Library::TypeLibrary* p, uint8_t attacking,
|
||
|
uint8_t defensive[], size_t defensiveCount) {
|
||
|
return p->GetEffectiveness(attacking, std::vector<uint8_t>(defensive, defensive + defensiveCount));
|
||
|
}
|