2020-03-04 08:11:32 +00:00
|
|
|
#include "../../src/Library/GrowthRates/GrowthRate.hpp"
|
2020-03-04 14:00:57 +00:00
|
|
|
#include "../../src/Library/GrowthRates/ExternGrowthRate.hpp"
|
2020-03-04 08:11:32 +00:00
|
|
|
#include "../../src/Library/GrowthRates/LookupGrowthRate.hpp"
|
|
|
|
#define export extern "C"
|
|
|
|
using namespace CreatureLib::Library;
|
|
|
|
|
|
|
|
export GrowthRate* CreatureLib_LookupGrowthRate_Construct(uint32_t experiencePerLevel[], size_t count) {
|
|
|
|
std::vector<uint32_t> exp(experiencePerLevel, experiencePerLevel + count);
|
|
|
|
return new LookupGrowthRate(exp);
|
|
|
|
};
|
|
|
|
|
2020-03-04 14:00:57 +00:00
|
|
|
export GrowthRate* CreatureLib_ExternGrowthRate_Construct(uint8_t (*calcLevel)(uint32_t),
|
|
|
|
uint32_t (*calcExperience)(uint8_t)) {
|
|
|
|
return new ExternGrowthRate(calcLevel, calcExperience);
|
|
|
|
};
|
|
|
|
|
2020-03-04 08:11:32 +00:00
|
|
|
export void CreatureLib_GrowthRate_Destruct(const GrowthRate* p) { delete p; }
|
|
|
|
|
|
|
|
export uint8_t CreatureLib_GrowthRate_CalculateLevel(const GrowthRate* p, uint32_t experience) {
|
|
|
|
return p->CalculateLevel(experience);
|
|
|
|
}
|
|
|
|
|
|
|
|
export uint32_t CreatureLib_GrowthRate_CalculateExperience(const GrowthRate* p, uint8_t level) {
|
|
|
|
return p->CalculateExperience(level);
|
|
|
|
}
|