Register Item Library in AngelScript.
This commit is contained in:
parent
a88e4a89e7
commit
1573720e97
|
@ -1,11 +1,13 @@
|
||||||
#include "RegisterItemTypes.hpp"
|
#include "RegisterItemTypes.hpp"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "../../../Library/Items/Item.hpp"
|
#include "../../../Library/Items/Item.hpp"
|
||||||
|
#include "../../../Library/Items/ItemLibrary.hpp"
|
||||||
|
|
||||||
void RegisterItemTypes::Register(asIScriptEngine* engine) {
|
void RegisterItemTypes::Register(asIScriptEngine* engine) {
|
||||||
RegisterItemCategoryEnum(engine);
|
RegisterItemCategoryEnum(engine);
|
||||||
RegisterBattleItemCategoryEnum(engine);
|
RegisterBattleItemCategoryEnum(engine);
|
||||||
RegisterItemType(engine);
|
RegisterItemType(engine);
|
||||||
|
RegisterItemLibrary(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterItemTypes::RegisterItemCategoryEnum(asIScriptEngine* engine) {
|
void RegisterItemTypes::RegisterItemCategoryEnum(asIScriptEngine* engine) {
|
||||||
|
@ -65,3 +67,10 @@ void RegisterItemTypes::RegisterItemType(asIScriptEngine* engine) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void RegisterItemTypes::RegisterItemLibrary(asIScriptEngine* engine) {
|
||||||
|
[[maybe_unused]] int r = engine->RegisterObjectType("ItemLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||||
|
assert(r >= 0);
|
||||||
|
r = engine->RegisterObjectMethod("ItemLibrary", "const Item@ GetItem(const string &in name) const",
|
||||||
|
asMETHOD(PkmnLib::Library::ItemLibrary, GetItem), asCALL_THISCALL);
|
||||||
|
assert(r >= 0);
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ class RegisterItemTypes {
|
||||||
static void RegisterItemCategoryEnum(asIScriptEngine* engine);
|
static void RegisterItemCategoryEnum(asIScriptEngine* engine);
|
||||||
static void RegisterBattleItemCategoryEnum(asIScriptEngine* engine);
|
static void RegisterBattleItemCategoryEnum(asIScriptEngine* engine);
|
||||||
static void RegisterItemType(asIScriptEngine* engine);
|
static void RegisterItemType(asIScriptEngine* engine);
|
||||||
|
static void RegisterItemLibrary(asIScriptEngine* engine);
|
||||||
public:
|
public:
|
||||||
static void Register(asIScriptEngine* engine);
|
static void Register(asIScriptEngine* engine);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue