Fix Angelscript mishandling several smart pointers.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-02 21:52:34 +02:00
parent 64a22324c7
commit ce54861966
3 changed files with 11 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
#include <CreatureLib/Battling/Models/Battle.hpp>
#include <cstdint>
#include "../../../../Battling/Battle/Battle.hpp"
#include "../HelperFile.hpp"
void RegisterBattleClass::Register(asIScriptEngine* engine) {
RegisterChoiceQueue(engine);
@@ -42,6 +43,8 @@ void RegisterBattleClass::RegisterBattleRandom(asIScriptEngine* engine) {
Assert(r >= 0);
}
SMART_PTR_GETTER_FUNC(PkmnLib::Battling::Battle, CreatureLib::Battling::ChoiceQueue, GetCurrentTurnQueue);
void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("Battle", 0, asOBJ_REF | asOBJ_NOCOUNT);
Assert(r >= 0);
@@ -58,7 +61,7 @@ void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
asMETHOD(PkmnLib::Battling::Battle, GetRandom), asCALL_THISCALL);
Assert(r >= 0);
r = engine->RegisterObjectMethod("Battle", "ChoiceQueue@ get_TurnQueue() const property",
asMETHOD(PkmnLib::Battling::Battle, GetCurrentTurnQueue), asCALL_THISCALL);
asFUNCTION(GetCurrentTurnQueueWrapper), asCALL_CDECL_OBJFIRST);
Assert(r >= 0);
r = engine->RegisterObjectMethod(
"Battle", "void AddVolatile(const constString &in name) const",

View File

@@ -40,12 +40,13 @@ void RegisterPokemonClass::RegisterMoveLearnMethod(asIScriptEngine* engine) {
}
ENUM__SIZE_WRAPPER(LearnedMove_LearnMethodWrapper, CreatureLib::Battling::LearnedAttack, GetLearnMethod)
SMART_PTR_GETTER_FUNC(CreatureLib::Battling::LearnedAttack, const CreatureLib::Library::AttackData, GetAttack);
void RegisterPokemonClass::RegisterLearnedAttack(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("LearnedMove", 0, asOBJ_REF | asOBJ_NOCOUNT);
Assert(r >= 0);
r = engine->RegisterObjectMethod("LearnedMove", "const MoveData@ get_MoveData() const property",
asMETHOD(CreatureLib::Battling::LearnedAttack, GetAttack), asCALL_THISCALL);
asFUNCTION(GetAttackWrapper), asCALL_CDECL_OBJFIRST);
Assert(r >= 0);
r = engine->RegisterObjectMethod("LearnedMove", "uint8 get_MaxUses() const property",
asMETHOD(CreatureLib::Battling::LearnedAttack, GetMaxUses), asCALL_THISCALL);