diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp index 6ef763d..f4044f7 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterTurnChoices.cpp @@ -2,8 +2,11 @@ #include #include #include +#include "../HelperFile.hpp" #include "../RefCast.hpp" +BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::BaseTurnChoice, CreatureLib::Battling::Creature, GetUser); + void RegisterTurnChoices::Register(asIScriptEngine* engine) { RegisterTurnChoiceKindEnum(engine); RegisterBaseTurnChoice(engine); @@ -31,8 +34,8 @@ void RegisterTurnChoices::RegisterBaseTurnChoice(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("BaseTurnChoice", "TurnChoiceKind get_Kind() const property", asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetKind), asCALL_THISCALL); Ensure(r >= 0); - r = engine->RegisterObjectMethod("BaseTurnChoice", "Pokemon@ get_User() const property", - asMETHOD(CreatureLib::Battling::BaseTurnChoice, GetUser), asCALL_THISCALL); + r = engine->RegisterObjectMethod("BaseTurnChoice", "const Pokemon@ get_User() const property", + asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); } @@ -42,8 +45,8 @@ void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property", asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL); Ensure(r >= 0); - r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property", - asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetUser), asCALL_THISCALL); + r = engine->RegisterObjectMethod("MoveTurnChoice", "const Pokemon@ get_User() const property", + asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property", asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL); @@ -70,8 +73,8 @@ void RegisterTurnChoices::RegisterSwitchTurnChoice(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("SwitchTurnChoice", "TurnChoiceKind get_Kind() const property", asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetKind), asCALL_THISCALL); Ensure(r >= 0); - r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_User() const property", - asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetUser), asCALL_THISCALL); + r = engine->RegisterObjectMethod("SwitchTurnChoice", "const Pokemon@ get_User() const property", + asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); r = engine->RegisterObjectMethod("SwitchTurnChoice", "Pokemon@ get_NewPokemon() const property", asMETHOD(CreatureLib::Battling::SwitchTurnChoice, GetNewCreature), @@ -95,8 +98,8 @@ void RegisterTurnChoices::RegisterFleeTurnChoice(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("FleeTurnChoice", "TurnChoiceKind get_Kind() const property", asMETHOD(CreatureLib::Battling::FleeTurnChoice, GetKind), asCALL_THISCALL); Ensure(r >= 0); - r = engine->RegisterObjectMethod("FleeTurnChoice", "Pokemon@ get_User() const property", - asMETHOD(CreatureLib::Battling::FleeTurnChoice, GetUser), asCALL_THISCALL); + r = engine->RegisterObjectMethod("FleeTurnChoice", "const Pokemon@ get_User() const property", + asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); r = engine->RegisterObjectMethod(