C Interface for Lookup GrowthRate.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-04 09:11:32 +01:00
parent 33de8424be
commit 81e173ec1a
3 changed files with 33 additions and 10 deletions

View File

@@ -0,0 +1,19 @@
#include "../../src/Library/GrowthRates/GrowthRate.hpp"
#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);
};
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);
}