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 GrowthRateLibrary* CreatureLib_GrowthRateLibrary_Construct(size_t initialCapacity) {
return new GrowthRateLibrary(initialCapacity);
}
export void CreatureLib_GrowthRateLibrary_Destruct(GrowthRateLibrary* p) { delete p; }
export uint8_t CreatureLib_GrowthRateLibrary_CalculateLevel(level_int_t& out, GrowthRateLibrary* library,
const char* growthRate, uint32_t experience) {
Try(out = library->CalculateLevel(ArbUt::StringView::CalculateHash(growthRate), experience);)
}
export uint8_t CreatureLib_GrowthRateLibrary_CalculateLevelWithHash(level_int_t& out, GrowthRateLibrary* library,
uint32_t growthRateHash, uint32_t experience) {
Try(out = library->CalculateLevel(growthRateHash, experience);)
}
export uint8_t CreatureLib_GrowthRateLibrary_CalculateExperience(uint32_t& out, GrowthRateLibrary* library,
const char* growthRate, level_int_t level) {
Try(out = library->CalculateExperience(ArbUt::StringView::CalculateHash(growthRate), level);)
}
export uint8_t CreatureLib_GrowthRateLibrary_CalculateExperienceWithHash(uint32_t& out, GrowthRateLibrary* library,
uint32_t growthRateHash, level_int_t level) {
Try(out = library->CalculateExperience(growthRateHash, level);)
}
export uint8_t CreatureLib_GrowthRateLibrary_AddGrowthRate(GrowthRateLibrary* library, const char* growthRateName,
GrowthRate* growthRate) {
Try(library->AddGrowthRate(ArbUt::StringView::CalculateHash(growthRateName), growthRate);)
}
export uint8_t CreatureLib_GrowthRateLibrary_AddGrowthRateWithHash(GrowthRateLibrary* library, uint32_t growthRateHash,
GrowthRate* growthRate) {
Try(library->AddGrowthRate(growthRateHash, growthRate);)
}