CreatureLib/CInterface/Library/SpeciesVariant.cpp

30 lines
1.6 KiB
C++

#include "../../src/Library/CreatureData/SpeciesVariant.hpp"
#define export extern "C"
using namespace CreatureLib::Library;
using ConstString = Arbutils::CaseInsensitiveConstString;
export SpeciesVariant* CreatureLib_SpeciesVariant_Construct(
const char* name, float height, float weight, uint32_t baseExperience, uint8_t types[], size_t typeLength,
uint16_t baseHealth, uint16_t baseAttack, uint16_t baseDefense, uint16_t baseMagicalAttack,
uint16_t baseMagicalDefense, __uint8_t baseSpeed, const char* talents[], size_t talentsLength,
const char* secretTalents[], size_t secretTalentsLength, const LearnableAttacks* attacks) {
auto talentsWrapped = std::vector<ConstString>(talentsLength);
for (size_t i = 0; i < talentsLength; i++) {
talentsWrapped[i] = ConstString(talents[i]);
}
auto secretTalentsWrapped = std::vector<ConstString>(secretTalentsLength);
for (size_t i = 0; i < secretTalentsLength; i++) {
secretTalentsWrapped[i] = ConstString(secretTalents[i]);
}
return new SpeciesVariant(Arbutils::CaseInsensitiveConstString(name), height, weight, baseExperience,
std::vector<uint8_t>(types, types + typeLength),
CreatureLib::Core::StatisticSet<uint16_t>(baseHealth, baseAttack, baseDefense,
baseMagicalAttack, baseMagicalDefense,
baseSpeed),
talentsWrapped, secretTalentsWrapped, attacks);
}
export void CreatureLib_SpeciesVariant_Destruct(SpeciesVariant* p) { delete p; }