From 21092eb34789019bd81cb082abe4f1af7ebd4531 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 30 Oct 2021 17:11:26 +0200 Subject: [PATCH] Adds Getters and Setters for Weight and Height of a Pokemon in angelscript. --- .../TypeRegistry/Battling/RegisterPokemonClass.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp index 3cacc49..139b6d2 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterPokemonClass.cpp @@ -106,8 +106,17 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) { REGISTER_GETTER("Pokemon", "const narray@ get_Moves() const property", PkmnLib::Battling::Pokemon, GetMoves); - auto r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const", - asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST); + REGISTER_GETTER("Pokemon", "float get_Weight() const property", CreatureLib::Battling::Creature, GetWeight); + REGISTER_GETTER("Pokemon", "float get_Height() const property", CreatureLib::Battling::Creature, GetHeight); + auto r = engine->RegisterObjectMethod("Pokemon", "void set_Weight(float value) const property", + asMETHOD(PkmnLib::Battling::Pokemon, SetWeight), asCALL_THISCALL); + Ensure(r >= 0); + r = engine->RegisterObjectMethod("Pokemon", "void set_Height(float value) const property", + asMETHOD(PkmnLib::Battling::Pokemon, SetHeight), asCALL_THISCALL); + Ensure(r >= 0); + + r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const", + asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const constString &in name)", asFUNCTION(SetHeldItemWrapper), asCALL_CDECL_OBJFIRST);