Register GrowthRate Library in AngelScript.
This commit is contained in:
parent
faf22c9562
commit
a88e4a89e7
|
@ -1,9 +1,11 @@
|
||||||
#include "RegisterGrowthRateTypes.hpp"
|
#include "RegisterGrowthRateTypes.hpp"
|
||||||
#include <Library/GrowthRates/GrowthRate.hpp>
|
#include <Library/GrowthRates/GrowthRate.hpp>
|
||||||
|
#include <Library/GrowthRates/GrowthRateLibrary.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
|
void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
|
||||||
RegisterGrowthRateType(engine);
|
RegisterGrowthRateType(engine);
|
||||||
|
RegisterGrowthRateLibrary(engine);
|
||||||
}
|
}
|
||||||
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
|
||||||
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRate", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
[[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);
|
asMETHOD(CreatureLib::Library::GrowthRate, CalculateExperience), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
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 {
|
class RegisterGrowthRateTypes {
|
||||||
static void RegisterGrowthRateType(asIScriptEngine* engine);
|
static void RegisterGrowthRateType(asIScriptEngine* engine);
|
||||||
|
static void RegisterGrowthRateLibrary(asIScriptEngine* engine);
|
||||||
public:
|
public:
|
||||||
static void Register(asIScriptEngine* engine);
|
static void Register(asIScriptEngine* engine);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue