Fix Angelscript mishandling several smart pointers.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
64a22324c7
commit
ce54861966
|
@ -6,6 +6,7 @@
|
|||
#include "../../../extern/angelscript_addons/scripthelper/scripthelper.h"
|
||||
#include "../../../extern/angelscript_addons/scriptstdstring/scriptstdstring.h"
|
||||
#include "../../Battling/PkmnScriptCategory.hpp"
|
||||
#include "../../Battling/Pokemon/Pokemon.hpp"
|
||||
#include "ByteCodeHandling/FileByteCodeStream.hpp"
|
||||
#include "ByteCodeHandling/MemoryByteCodeStream.hpp"
|
||||
#include "TypeRegistry/BasicScriptClass.hpp"
|
||||
|
@ -15,6 +16,7 @@
|
|||
#include "TypeRegistry/Battling/RegisterPokemonClass.hpp"
|
||||
#include "TypeRegistry/Battling/RegisterTurnChoices.hpp"
|
||||
#include "TypeRegistry/ConstString.hpp"
|
||||
#include "TypeRegistry/HelperFile.hpp"
|
||||
#include "TypeRegistry/Library/RegisterEffectParameter.hpp"
|
||||
#include "TypeRegistry/Library/RegisterGrowthRateTypes.hpp"
|
||||
#include "TypeRegistry/Library/RegisterItemTypes.hpp"
|
||||
|
@ -87,6 +89,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg)
|
|||
|
||||
_contextPool = new ContextPool(_engine);
|
||||
}
|
||||
SMART_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle);
|
||||
|
||||
void AngelScriptResolver::RegisterTypes() {
|
||||
// Register static library types
|
||||
|
@ -104,9 +107,8 @@ void AngelScriptResolver::RegisterTypes() {
|
|||
RegisterTurnChoices::Register(_engine);
|
||||
RegisterBattleLibrary::Register(_engine);
|
||||
RegisterBattleClass::Register(_engine);
|
||||
[[maybe_unused]] int r =
|
||||
_engine->RegisterObjectMethod("Pokemon", "const Battle@ get_Battle() const property",
|
||||
asMETHOD(CreatureLib::Battling::Creature, GetBattle), asCALL_THISCALL);
|
||||
[[maybe_unused]] int r = _engine->RegisterObjectMethod("Pokemon", "const Battle@ get_Battle() const property",
|
||||
asFUNCTION(GetBattleWrapper), asCALL_CDECL_OBJFIRST);
|
||||
assert(r >= 0);
|
||||
|
||||
// Register base script
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue