2020-02-29 15:06:47 +00:00
|
|
|
#include "../../src/Library/TypeLibrary.hpp"
|
2020-03-25 18:07:36 +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
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetTypeId(uint8_t& out, const TypeLibrary* p, const char* type) {
|
2020-05-26 16:31:06 +00:00
|
|
|
Try(out = p->GetTypeId(ArbUt::CaseInsensitiveConstString::GetHash(type));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetTypeIdWithHash(uint8_t& out, const TypeLibrary* p, uint32_t type) {
|
|
|
|
Try(out = p->GetTypeId(type);)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_RegisterType(uint8_t& out, TypeLibrary* p, const char* type) {
|
2020-05-26 16:31:06 +00:00
|
|
|
Try(out = p->RegisterType(ArbUt::CaseInsensitiveConstString::GetHash(type));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_RegisterTypeWithHash(uint8_t& out, TypeLibrary* p, uint32_t type) {
|
|
|
|
Try(out = p->RegisterType(type);)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_SetEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive,
|
|
|
|
float effectiveness) {
|
|
|
|
Try(p->SetEffectiveness(attacking, defensive, effectiveness);)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetSingleEffectiveness(float& out, TypeLibrary* p, uint8_t attacking,
|
|
|
|
uint8_t defensive) {
|
|
|
|
Try(out = p->GetSingleEffectiveness(attacking, defensive);)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetEffectiveness(float& out, TypeLibrary* p, uint8_t attacking,
|
|
|
|
uint8_t defensive[], size_t defensiveCount) {
|
2020-06-05 14:38:27 +00:00
|
|
|
Try(out = p->GetEffectiveness(attacking, std::unordered_set<uint8_t>(defensive, defensive + defensiveCount));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|