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

@@ -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