CreatureLib/CInterface/Library/TypeLibrary.cpp

33 lines
1.4 KiB
C++
Raw Normal View History

#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 u8 CreatureLib_TypeLibrary_GetTypeId(u8& out, const TypeLibrary* p, const char* type) {
Try(out = p->GetTypeId(ArbUt::StringView(type));)
}
export u8 CreatureLib_TypeLibrary_RegisterType(u8& out, TypeLibrary* p, const char* type) {
Try(out = p->RegisterType(ArbUt::StringView(type));)
}
export u8 CreatureLib_TypeLibrary_SetEffectiveness(TypeLibrary* p, u8 attacking, u8 defensive, float effectiveness) {
Try(p->SetEffectiveness(attacking, defensive, effectiveness);)
}
export u8 CreatureLib_TypeLibrary_GetSingleEffectiveness(float& out, TypeLibrary* p, u8 attacking, u8 defensive) {
Try(out = p->GetSingleEffectiveness(attacking, defensive);)
}
export u8 CreatureLib_TypeLibrary_GetEffectiveness(float& out, TypeLibrary* p, u8 attacking, u8 defensive[],
size_t defensiveCount) {
Try(out = p->GetEffectiveness(attacking, std::vector<u8>(defensive, defensive + defensiveCount));)
}
export u8 CreatureLib_TypeLibrary_GetTypeName(const char*& out, TypeLibrary* p, u8 type) {
Try(out = p->GetTypeName(type).c_str();)
}