2020-02-29 15:06:47 +00:00
|
|
|
#include "../../src/Library/TypeLibrary.hpp"
|
2020-07-31 08:51:03 +00:00
|
|
|
#include "../Core.hpp"
|
2020-02-29 16:21:36 +00:00
|
|
|
using namespace CreatureLib::Library;
|
2020-02-29 15:06:47 +00:00
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export TypeLibrary* CreatureLib_TypeLibrary_Construct(size_t initialCapacity) {
|
|
|
|
return new TypeLibrary(initialCapacity);
|
2020-02-29 15:06:47 +00:00
|
|
|
};
|
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export void CreatureLib_TypeLibrary_Destruct(const TypeLibrary* p) { delete p; }
|
2020-02-29 15:06:47 +00:00
|
|
|
|
2022-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_TypeLibrary_GetTypeId(u8& out, const TypeLibrary* p, const char* type) {
|
2020-08-08 10:54:28 +00:00
|
|
|
Try(out = p->GetTypeId(ArbUt::StringView(type));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
2022-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_TypeLibrary_RegisterType(u8& out, TypeLibrary* p, const char* type) {
|
2020-08-08 10:54:28 +00:00
|
|
|
Try(out = p->RegisterType(ArbUt::StringView(type));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_TypeLibrary_SetEffectiveness(TypeLibrary* p, u8 attacking, u8 defensive, float effectiveness) {
|
2020-03-25 18:07:36 +00:00
|
|
|
Try(p->SetEffectiveness(attacking, defensive, effectiveness);)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_TypeLibrary_GetSingleEffectiveness(float& out, TypeLibrary* p, u8 attacking, u8 defensive) {
|
2020-03-25 18:07:36 +00:00
|
|
|
Try(out = p->GetSingleEffectiveness(attacking, defensive);)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 12:56:45 +00:00
|
|
|
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));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
2022-03-23 12:56:45 +00:00
|
|
|
export u8 CreatureLib_TypeLibrary_GetTypeName(const char*& out, TypeLibrary* p, u8 type) {
|
2020-08-08 10:54:28 +00:00
|
|
|
Try(out = p->GetTypeName(type).c_str();)
|
|
|
|
}
|