From 939cf4e3280a004b375504c4eba929f01d2c0101 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 18 Apr 2021 12:56:46 +0200 Subject: [PATCH] Update CreatureLib. --- CMakeLists.txt.angelscript.in | 2 +- CMakeLists.txt.creaturelib.in | 2 +- src/Battling/PkmnScriptHook.hpp | 4 ++-- tests/ScriptTests/BaseScriptClassTests.cpp | 8 +++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt.angelscript.in b/CMakeLists.txt.angelscript.in index 412cd4b..9c2ef89 100644 --- a/CMakeLists.txt.angelscript.in +++ b/CMakeLists.txt.angelscript.in @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8.12) -project(angelscript-download NONE) +project(pkmnLib NONE) include(ExternalProject) diff --git a/CMakeLists.txt.creaturelib.in b/CMakeLists.txt.creaturelib.in index e5b96a7..388ca0e 100644 --- a/CMakeLists.txt.creaturelib.in +++ b/CMakeLists.txt.creaturelib.in @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8.12) -project(creaturelib-download NONE) +project(pkmnLib NONE) include(ExternalProject) ExternalProject_Add(CreatureLibProj diff --git a/src/Battling/PkmnScriptHook.hpp b/src/Battling/PkmnScriptHook.hpp index a7d1cc2..76d4558 100644 --- a/src/Battling/PkmnScriptHook.hpp +++ b/src/Battling/PkmnScriptHook.hpp @@ -3,8 +3,8 @@ #define PKMN_HOOK(hookName, source, ...) \ { \ auto aggregator = source->GetScriptIterator(); \ - while (aggregator.HasNext()) { \ - auto next = aggregator.GetNext(); \ + ArbUt::BorrowedPtr next = (CreatureLib::Battling::BattleScript*)1; \ + while (aggregator.GetNext(next)) { \ auto castNext = next.ForceAs(); \ castNext->hookName(__VA_ARGS__); \ } \ diff --git a/tests/ScriptTests/BaseScriptClassTests.cpp b/tests/ScriptTests/BaseScriptClassTests.cpp index b0e6f91..7159121 100644 --- a/tests/ScriptTests/BaseScriptClassTests.cpp +++ b/tests/ScriptTests/BaseScriptClassTests.cpp @@ -391,11 +391,9 @@ TEST_CASE("Add Volatile with return script function") { script->OnSecondaryEffect(nullptr, mon, 0); - auto scriptObjOption = - const_cast(mon->GetScriptIterator()).GetNextNotNull(); - REQUIRE(scriptObjOption.has_value()); - REQUIRE(scriptObjOption.value()->GetName() == "AddVolatileModSecondary"_cnc); - auto scriptObj = scriptObjOption.value(); + ArbUt::BorrowedPtr scriptObj = (CreatureLib::Battling::BattleScript*)1; + REQUIRE(const_cast(mon->GetScriptIterator()).GetNext(scriptObj)); + REQUIRE(scriptObj->GetName() == "AddVolatileModSecondary"_cnc); auto script2 = scriptObj.As(); auto ctxPool = script2->GetContextPool(); auto ctx = ctxPool->RequestContext();