From 6225ed19fa05b03629191dccd97116961a082d40 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 2 Jun 2020 21:26:57 +0200 Subject: [PATCH] Mark user in ExecutingAttack as smart pointer --- .../TypeRegistry/Battling/RegisterExecutingAttack.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterExecutingAttack.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterExecutingAttack.cpp index b6aacde..c70d6fd 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterExecutingAttack.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterExecutingAttack.cpp @@ -1,11 +1,14 @@ #include "RegisterExecutingAttack.hpp" #include #include +#include "../HelperFile.hpp" void RegisterExecutingAttack::Register(asIScriptEngine* engine) { RegisterHitData(engine); RegisterExecutingAttackType(engine); } +SMART_PTR_GETTER_FUNC(CreatureLib::Battling::ExecutingAttack, CreatureLib::Battling::Creature, GetUser); + void RegisterExecutingAttack::RegisterHitData(asIScriptEngine* engine) { [[maybe_unused]] int r = engine->RegisterObjectType("HitData", 0, asOBJ_REF | asOBJ_NOCOUNT); Assert(r >= 0); @@ -40,8 +43,8 @@ void RegisterExecutingAttack::RegisterExecutingAttackType(asIScriptEngine* engin asMETHOD(CreatureLib::Battling::ExecutingAttack, IsCreatureTarget), asCALL_THISCALL); Assert(r >= 0); - r = engine->RegisterObjectMethod("ExecutingMove", "Pokemon@ get_User() const property", - asMETHOD(CreatureLib::Battling::ExecutingAttack, GetUser), asCALL_THISCALL); + r = engine->RegisterObjectMethod("ExecutingMove", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper), + asCALL_CDECL_OBJFIRST); Assert(r >= 0); r = engine->RegisterObjectMethod("ExecutingMove", "LearnedMove@ get_Move() const property", asMETHOD(CreatureLib::Battling::ExecutingAttack, GetAttack), asCALL_THISCALL);