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"
|
2020-03-25 18:07:36 +00:00
|
|
|
#include "../Core.hpp"
|
2020-03-04 08:11:32 +00:00
|
|
|
using namespace CreatureLib::Library;
|
|
|
|
|
|
|
|
export GrowthRate* CreatureLib_LookupGrowthRate_Construct(uint32_t experiencePerLevel[], size_t count) {
|
2020-05-26 16:31:06 +00:00
|
|
|
ArbUt::List<uint32_t> exp(experiencePerLevel, experiencePerLevel + count);
|
2020-03-04 08:11:32 +00:00
|
|
|
return new LookupGrowthRate(exp);
|
|
|
|
};
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_ExternGrowthRate_Construct(GrowthRate*& out, uint8_t (*calcLevel)(uint32_t),
|
|
|
|
uint32_t (*calcExperience)(uint8_t)) {
|
|
|
|
Try(out = new ExternGrowthRate(calcLevel, calcExperience);)
|
2020-03-04 14:00:57 +00:00
|
|
|
};
|
|
|
|
|
2020-03-04 08:11:32 +00:00
|
|
|
export void CreatureLib_GrowthRate_Destruct(const GrowthRate* p) { delete p; }
|
2020-05-06 09:36:56 +00:00
|
|
|
export void CreatureLib_LookupGrowthRate_Destruct(const LookupGrowthRate* p) { delete p; }
|
|
|
|
export void CreatureLib_ExternGrowthRate_Destruct(const ExternGrowthRate* p) { delete p; }
|
2020-03-04 08:11:32 +00:00
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_GrowthRate_CalculateLevel(uint8_t& out, const GrowthRate* p, uint32_t experience) {
|
|
|
|
Try(out = p->CalculateLevel(experience);)
|
2020-03-04 08:11:32 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t CreatureLib_GrowthRate_CalculateExperience(uint32_t& out, const GrowthRate* p, uint8_t level) {
|
|
|
|
Try(out = p->CalculateExperience(level);)
|
2020-03-04 08:11:32 +00:00
|
|
|
}
|