Register Move Library in AngelScript.
This commit is contained in:
parent
1573720e97
commit
dbc8aa2675
|
@ -1,11 +1,13 @@
|
||||||
#include "RegisterMoveTypes.hpp"
|
#include "RegisterMoveTypes.hpp"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "../../../Library/Moves/MoveData.hpp"
|
#include "../../../Library/Moves/MoveData.hpp"
|
||||||
|
#include "../../../Library/Moves/MoveLibrary.hpp"
|
||||||
|
|
||||||
void RegisterMoveTypes::Register(asIScriptEngine* engine) {
|
void RegisterMoveTypes::Register(asIScriptEngine* engine) {
|
||||||
RegisterMoveCategory(engine);
|
RegisterMoveCategory(engine);
|
||||||
RegisterMoveTarget(engine);
|
RegisterMoveTarget(engine);
|
||||||
RegisterMoveType(engine);
|
RegisterMoveType(engine);
|
||||||
|
RegisterMoveLibrary(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REGISTER_ENUM_VALUE(asName, cName, valueName) \
|
#define REGISTER_ENUM_VALUE(asName, cName, valueName) \
|
||||||
|
@ -68,5 +70,13 @@ void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) {
|
||||||
asMETHOD(PkmnLib::Library::MoveData, HasFlag), asCALL_THISCALL);
|
asMETHOD(PkmnLib::Library::MoveData, HasFlag), asCALL_THISCALL);
|
||||||
assert(r >= 0);
|
assert(r >= 0);
|
||||||
}
|
}
|
||||||
|
void RegisterMoveTypes::RegisterMoveLibrary(asIScriptEngine* engine) {
|
||||||
|
[[maybe_unused]] int r = engine->RegisterObjectType("MoveLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
|
assert(r >= 0);
|
||||||
|
r = engine->RegisterObjectMethod("MoveLibrary", "const MoveData@ GetMove(const string &in flag) const",
|
||||||
|
asMETHOD(PkmnLib::Library::MoveLibrary, GetMove), asCALL_THISCALL);
|
||||||
|
assert(r >= 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef REGISTER_ENUM_VALUE
|
#undef REGISTER_ENUM_VALUE
|
|
@ -6,6 +6,7 @@ class RegisterMoveTypes {
|
||||||
static void RegisterMoveCategory(asIScriptEngine* engine);
|
static void RegisterMoveCategory(asIScriptEngine* engine);
|
||||||
static void RegisterMoveTarget(asIScriptEngine* engine);
|
static void RegisterMoveTarget(asIScriptEngine* engine);
|
||||||
static void RegisterMoveType(asIScriptEngine* engine);
|
static void RegisterMoveType(asIScriptEngine* engine);
|
||||||
|
static void RegisterMoveLibrary(asIScriptEngine* engine);
|
||||||
public:
|
public:
|
||||||
static void Register(asIScriptEngine* engine);
|
static void Register(asIScriptEngine* engine);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue