Mark user in ExecutingAttack as smart pointer

This commit is contained in:
Deukhoofd 2020-06-02 21:26:57 +02:00
parent 2d3a2fc63b
commit 6225ed19fa
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 5 additions and 2 deletions

View File

@ -1,11 +1,14 @@
#include "RegisterExecutingAttack.hpp" #include "RegisterExecutingAttack.hpp"
#include <Arbutils/Assert.hpp> #include <Arbutils/Assert.hpp>
#include <CreatureLib/Battling/Models/ExecutingAttack.hpp> #include <CreatureLib/Battling/Models/ExecutingAttack.hpp>
#include "../HelperFile.hpp"
void RegisterExecutingAttack::Register(asIScriptEngine* engine) { void RegisterExecutingAttack::Register(asIScriptEngine* engine) {
RegisterHitData(engine); RegisterHitData(engine);
RegisterExecutingAttackType(engine); RegisterExecutingAttackType(engine);
} }
SMART_PTR_GETTER_FUNC(CreatureLib::Battling::ExecutingAttack, CreatureLib::Battling::Creature, GetUser);
void RegisterExecutingAttack::RegisterHitData(asIScriptEngine* engine) { void RegisterExecutingAttack::RegisterHitData(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("HitData", 0, asOBJ_REF | asOBJ_NOCOUNT); [[maybe_unused]] int r = engine->RegisterObjectType("HitData", 0, asOBJ_REF | asOBJ_NOCOUNT);
Assert(r >= 0); Assert(r >= 0);
@ -40,8 +43,8 @@ void RegisterExecutingAttack::RegisterExecutingAttackType(asIScriptEngine* engin
asMETHOD(CreatureLib::Battling::ExecutingAttack, IsCreatureTarget), asMETHOD(CreatureLib::Battling::ExecutingAttack, IsCreatureTarget),
asCALL_THISCALL); asCALL_THISCALL);
Assert(r >= 0); Assert(r >= 0);
r = engine->RegisterObjectMethod("ExecutingMove", "Pokemon@ get_User() const property", r = engine->RegisterObjectMethod("ExecutingMove", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper),
asMETHOD(CreatureLib::Battling::ExecutingAttack, GetUser), asCALL_THISCALL); asCALL_CDECL_OBJFIRST);
Assert(r >= 0); Assert(r >= 0);
r = engine->RegisterObjectMethod("ExecutingMove", "LearnedMove@ get_Move() const property", r = engine->RegisterObjectMethod("ExecutingMove", "LearnedMove@ get_Move() const property",
asMETHOD(CreatureLib::Battling::ExecutingAttack, GetAttack), asCALL_THISCALL); asMETHOD(CreatureLib::Battling::ExecutingAttack, GetAttack), asCALL_THISCALL);