CreatureLib/CInterface/Library/TypeLibrary.cpp

38 lines
1.6 KiB
C++
Raw Normal View History

#include "../../src/Library/TypeLibrary.hpp"
#define export extern "C"
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(const TypeLibrary* p, const char* type) {
return p->GetTypeId(Arbutils::CaseInsensitiveConstString::GetHash(type));
}
export uint8_t CreatureLib_TypeLibrary_GetTypeIdWithHash(const TypeLibrary* p, uint32_t type) {
return p->GetTypeId(type);
}
export uint8_t CreatureLib_TypeLibrary_RegisterType(TypeLibrary* p, const char* type) {
return p->RegisterType(Arbutils::CaseInsensitiveConstString::GetHash(type));
}
export uint8_t CreatureLib_TypeLibrary_RegisterTypeWithHash(TypeLibrary* p, uint32_t type) {
return p->RegisterType(type);
}
export void CreatureLib_TypeLibrary_SetEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive,
float effectiveness) {
p->SetEffectiveness(attacking, defensive, effectiveness);
}
export float CreatureLib_TypeLibrary_GetSingleEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive) {
return p->GetSingleEffectiveness(attacking, defensive);
}
export float CreatureLib_TypeLibrary_GetEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive[],
size_t defensiveCount) {
return p->GetEffectiveness(attacking, std::vector<uint8_t>(defensive, defensive + defensiveCount));
}