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