CreatureLib/CInterface/Library/TypeLibrary.cpp

35 lines
1.6 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::StringView(type));)
}
export uint8_t CreatureLib_TypeLibrary_RegisterType(uint8_t& out, TypeLibrary* p, const char* type) {
Try(out = p->RegisterType(ArbUt::StringView(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));)
}
export uint8_t CreatureLib_TypeLibrary_GetTypeName(const char*& out, TypeLibrary* p, uint8_t type) {
Try(out = p->GetTypeName(type).c_str();)
}