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
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetTypeId(uint8_t& 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
|
|
|
}
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_RegisterType(uint8_t& 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
|
|
|
}
|
|
|
|
|
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-10-23 14:51:15 +00:00
|
|
|
Try(out = p->GetEffectiveness(attacking, std::vector<uint8_t>(defensive, defensive + defensiveCount));)
|
2020-02-29 15:06:47 +00:00
|
|
|
}
|
2020-08-08 10:54:28 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetTypeName(const char*& out, TypeLibrary* p, uint8_t type) {
|
|
|
|
Try(out = p->GetTypeName(type).c_str();)
|
|
|
|
}
|