Use borrowedPtr helpers in AngelScript turn choices.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-03-28 17:35:00 +02:00
parent 514de9a2ba
commit 76053af77f
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 11 additions and 8 deletions

View File

@ -2,8 +2,11 @@
#include <CreatureLib/Battling/TurnChoices/AttackTurnChoice.hpp>
#include <CreatureLib/Battling/TurnChoices/BaseTurnChoice.hpp>
#include <CreatureLib/Battling/TurnChoices/SwitchTurnChoice.hpp>
#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(