Register GrowthRate Library in AngelScript.
This commit is contained in:
parent
faf22c9562
commit
a88e4a89e7
|
@ -1,9 +1,11 @@
|
|||
#include "RegisterGrowthRateTypes.hpp"
|
||||
#include <Library/GrowthRates/GrowthRate.hpp>
|
||||
#include <Library/GrowthRates/GrowthRateLibrary.hpp>
|
||||
#include <cassert>
|
||||
|
||||
void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
|
||||
RegisterGrowthRateType(engine);
|
||||
RegisterGrowthRateLibrary(engine);
|
||||
}
|
||||
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
||||
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRate", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||
|
@ -15,3 +17,13 @@ void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
|||
asMETHOD(CreatureLib::Library::GrowthRate, CalculateExperience), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
}
|
||||
void RegisterGrowthRateTypes::RegisterGrowthRateLibrary(asIScriptEngine* engine) {
|
||||
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRateLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||
assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("GrowthRateLibrary", "uint8 CalculateLevel(const string &in growthRate, uint experience) const",
|
||||
asMETHOD(CreatureLib::Library::GrowthRateLibrary, CalculateLevel), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
r = engine->RegisterObjectMethod("GrowthRateLibrary", "uint CalculateExperience(const string &in growthRate, uint8 experience) const",
|
||||
asMETHOD(CreatureLib::Library::GrowthRateLibrary, CalculateExperience), asCALL_THISCALL);
|
||||
assert(r >= 0);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
class RegisterGrowthRateTypes {
|
||||
static void RegisterGrowthRateType(asIScriptEngine* engine);
|
||||
static void RegisterGrowthRateLibrary(asIScriptEngine* engine);
|
||||
public:
|
||||
static void Register(asIScriptEngine* engine);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue