2020-02-29 15:06:47 +00:00
|
|
|
#include "../../src/Library/TypeLibrary.hpp"
|
|
|
|
#define export extern "C"
|
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-02-29 16:21:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetTypeId(const TypeLibrary* p, const char* type) {
|
2020-02-29 15:06:47 +00:00
|
|
|
return p->GetTypeId(Arbutils::CaseInsensitiveConstString::GetHash(type));
|
|
|
|
}
|
2020-02-29 16:21:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_GetTypeIdWithHash(const TypeLibrary* p, uint32_t type) {
|
2020-02-29 15:06:47 +00:00
|
|
|
return p->GetTypeId(type);
|
|
|
|
}
|
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_RegisterType(TypeLibrary* p, const char* type) {
|
2020-02-29 15:06:47 +00:00
|
|
|
return p->RegisterType(Arbutils::CaseInsensitiveConstString::GetHash(type));
|
|
|
|
}
|
2020-02-29 16:21:36 +00:00
|
|
|
export uint8_t CreatureLib_TypeLibrary_RegisterTypeWithHash(TypeLibrary* p, uint32_t type) {
|
2020-02-29 15:06:47 +00:00
|
|
|
return p->RegisterType(type);
|
|
|
|
}
|
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export void CreatureLib_TypeLibrary_SetEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive,
|
|
|
|
float effectiveness) {
|
2020-02-29 15:06:47 +00:00
|
|
|
p->SetEffectiveness(attacking, defensive, effectiveness);
|
|
|
|
}
|
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export float CreatureLib_TypeLibrary_GetSingleEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive) {
|
2020-02-29 15:06:47 +00:00
|
|
|
return p->GetSingleEffectiveness(attacking, defensive);
|
|
|
|
}
|
|
|
|
|
2020-02-29 16:21:36 +00:00
|
|
|
export float CreatureLib_TypeLibrary_GetEffectiveness(TypeLibrary* p, uint8_t attacking, uint8_t defensive[],
|
|
|
|
size_t defensiveCount) {
|
2020-02-29 15:06:47 +00:00
|
|
|
return p->GetEffectiveness(attacking, std::vector<uint8_t>(defensive, defensive + defensiveCount));
|
|
|
|
}
|