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