diff --git a/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.cpp b/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.cpp index 60d5286..351226d 100644 --- a/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.cpp +++ b/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.cpp @@ -1,11 +1,13 @@ #include "RegisterItemTypes.hpp" #include #include "../../../Library/Items/Item.hpp" +#include "../../../Library/Items/ItemLibrary.hpp" void RegisterItemTypes::Register(asIScriptEngine* engine) { RegisterItemCategoryEnum(engine); RegisterBattleItemCategoryEnum(engine); RegisterItemType(engine); + RegisterItemLibrary(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); +} diff --git a/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.hpp b/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.hpp index 7b775da..e3cb62d 100644 --- a/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.hpp +++ b/src/AngelScript/TypeRegistry/Library/RegisterItemTypes.hpp @@ -6,6 +6,7 @@ class RegisterItemTypes { static void RegisterItemCategoryEnum(asIScriptEngine* engine); static void RegisterBattleItemCategoryEnum(asIScriptEngine* engine); static void RegisterItemType(asIScriptEngine* engine); + static void RegisterItemLibrary(asIScriptEngine* engine); public: static void Register(asIScriptEngine* engine); };