27 lines
1.2 KiB
C++
27 lines
1.2 KiB
C++
#include "../../src/Library/GrowthRates/GrowthRate.hpp"
|
|
#include "../../src/Library/GrowthRates/ExternGrowthRate.hpp"
|
|
#include "../../src/Library/GrowthRates/LookupGrowthRate.hpp"
|
|
#include "../Core.hpp"
|
|
using namespace CreatureLib::Library;
|
|
|
|
export GrowthRate* CreatureLib_LookupGrowthRate_Construct(u32 experiencePerLevel[], size_t count) {
|
|
ArbUt::List<u32> exp(experiencePerLevel, experiencePerLevel + count);
|
|
return new LookupGrowthRate(exp);
|
|
};
|
|
|
|
export u8 CreatureLib_ExternGrowthRate_Construct(GrowthRate*& out, level_int_t (*calcLevel)(u32),
|
|
u32 (*calcExperience)(level_int_t)) {
|
|
Try(out = new ExternGrowthRate(calcLevel, calcExperience);)
|
|
};
|
|
|
|
export void CreatureLib_GrowthRate_Destruct(const GrowthRate* p) { delete p; }
|
|
export void CreatureLib_LookupGrowthRate_Destruct(const LookupGrowthRate* p) { delete p; }
|
|
export void CreatureLib_ExternGrowthRate_Destruct(const ExternGrowthRate* p) { delete p; }
|
|
|
|
export u8 CreatureLib_GrowthRate_CalculateLevel(level_int_t& out, const GrowthRate* p, u32 experience) {
|
|
Try(out = p->CalculateLevel(experience);)
|
|
}
|
|
|
|
export u8 CreatureLib_GrowthRate_CalculateExperience(u32& out, const GrowthRate* p, level_int_t level) {
|
|
Try(out = p->CalculateExperience(level);)
|
|
} |