CreatureLib/CInterface/Library/TypeLibrary.cpp

34 lines
1.5 KiB
C++
Raw Normal View History

#include "../../src/Library/TypeLibrary.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Library;
2022-04-02 10:33:26 +00:00
export_func TypeLibrary* CreatureLib_TypeLibrary_Construct(size_t initialCapacity) {
return new TypeLibrary(initialCapacity);
};
2022-04-02 10:33:26 +00:00
export_func void CreatureLib_TypeLibrary_Destruct(const TypeLibrary* p) { delete p; }
2022-04-02 10:33:26 +00:00
export_func u8 CreatureLib_TypeLibrary_GetTypeId(u8& out, const TypeLibrary* p, const char* type) {
Try(out = p->GetTypeId(ArbUt::StringView(type));)
}
2022-04-02 10:33:26 +00:00
export_func u8 CreatureLib_TypeLibrary_RegisterType(u8& out, TypeLibrary* p, const char* type) {
Try(out = p->RegisterType(ArbUt::StringView(type));)
}
2022-04-02 10:33:26 +00:00
export_func u8 CreatureLib_TypeLibrary_SetEffectiveness(TypeLibrary* p, u8 attacking, u8 defensive,
float effectiveness) {
Try(p->SetEffectiveness(attacking, defensive, effectiveness);)
}
2022-04-02 10:33:26 +00:00
export_func u8 CreatureLib_TypeLibrary_GetSingleEffectiveness(float& out, TypeLibrary* p, u8 attacking, u8 defensive) {
Try(out = p->GetSingleEffectiveness(attacking, defensive);)
}
2022-04-02 10:33:26 +00:00
export_func 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));)
}
2022-04-02 10:33:26 +00:00
export_func u8 CreatureLib_TypeLibrary_GetTypeName(const char*& out, TypeLibrary* p, u8 type) {
Try(out = p->GetTypeName(type).c_str();)
}