CreatureLib/CInterface/Library/GrowthRateLibrary.cpp

38 lines
2.1 KiB
C++

#include "../../src/Library/GrowthRates/GrowthRateLibrary.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Library;
export_func GrowthRateLibrary* CreatureLib_GrowthRateLibrary_Construct(size_t initialCapacity) {
return new GrowthRateLibrary(initialCapacity);
}
export_func void CreatureLib_GrowthRateLibrary_Destruct(GrowthRateLibrary* p) { delete p; }
export_func u8 CreatureLib_GrowthRateLibrary_CalculateLevel(level_int_t& out, GrowthRateLibrary* library,
const char* growthRate, u32 experience) {
Try(out = library->CalculateLevel(ArbUt::StringView::CalculateHash(growthRate), experience);)
}
export_func u8 CreatureLib_GrowthRateLibrary_CalculateLevelWithHash(level_int_t& out, GrowthRateLibrary* library,
u32 growthRateHash, u32 experience) {
Try(out = library->CalculateLevel(growthRateHash, experience);)
}
export_func u8 CreatureLib_GrowthRateLibrary_CalculateExperience(u32& out, GrowthRateLibrary* library,
const char* growthRate, level_int_t level) {
Try(out = library->CalculateExperience(ArbUt::StringView::CalculateHash(growthRate), level);)
}
export_func u8 CreatureLib_GrowthRateLibrary_CalculateExperienceWithHash(u32& out, GrowthRateLibrary* library,
u32 growthRateHash, level_int_t level) {
Try(out = library->CalculateExperience(growthRateHash, level);)
}
export_func u8 CreatureLib_GrowthRateLibrary_AddGrowthRate(GrowthRateLibrary* library, const char* growthRateName,
GrowthRate* growthRate) {
Try(library->AddGrowthRate(ArbUt::StringView::CalculateHash(growthRateName), growthRate);)
}
export_func u8 CreatureLib_GrowthRateLibrary_AddGrowthRateWithHash(GrowthRateLibrary* library, u32 growthRateHash,
GrowthRate* growthRate) {
Try(library->AddGrowthRate(growthRateHash, growthRate);)
}