From 50c58a9fd3c7d02966087be17d2bb19fa9d8e428 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 14 May 2022 11:59:54 +0200 Subject: [PATCH] Fixes build failures in Angelscript --- .../AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp | 7 ++++++- tests/ScriptTests/Angelscript/BaseScriptClassTests.cpp | 2 +- tests/ScriptTests/Angelscript/ItemUseScriptTests.cpp | 2 +- tests/ScriptTests/Angelscript/ScriptOwnerTest.cpp | 2 +- tests/ScriptTests/Angelscript/ScriptResolverTests.cpp | 2 +- .../Angelscript/ScriptTypeTests/Battle/BattleTests.cpp | 2 +- .../Angelscript/ScriptTypeTests/Battle/PokemonTests.cpp | 2 +- .../Angelscript/ScriptTypeTests/Library/FormesTests.cpp | 2 +- .../Angelscript/ScriptTypeTests/Library/ItemDataTests.cpp | 2 +- .../Angelscript/ScriptTypeTests/Library/MoveTests.cpp | 2 +- .../Angelscript/ScriptTypeTests/Library/SpeciesTests.cpp | 2 +- .../ScriptTypeTests/Library/StaticLibraryTests.cpp | 2 +- 12 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp index bad3402..44fd571 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Library/RegisterMoveTypes.cpp @@ -22,6 +22,11 @@ static bool HasFlag(const PkmnLib::Library::MoveData* obj, const ArbUt::BasicStr return obj->HasFlag(str); } +static bool GetMove(const PkmnLib::Library::MoveLibrary* obj, const ArbUt::BasicStringView& str) { + return obj->Get(str); +} + + void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) { int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT); Ensure(r >= 0); @@ -46,7 +51,7 @@ void RegisterMoveTypes::RegisterMoveLibrary(asIScriptEngine* engine) { int r = engine->RegisterObjectType("MoveLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT); Ensure(r >= 0); r = engine->RegisterObjectMethod("MoveLibrary", "const MoveData@ Get(const constString &in name) const", - asMETHOD(PkmnLib::Library::MoveLibrary, Get), asCALL_THISCALL); + asFUNCTION(GetMove), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); } diff --git a/tests/ScriptTests/Angelscript/BaseScriptClassTests.cpp b/tests/ScriptTests/Angelscript/BaseScriptClassTests.cpp index 6c35259..4753f59 100644 --- a/tests/ScriptTests/Angelscript/BaseScriptClassTests.cpp +++ b/tests/ScriptTests/Angelscript/BaseScriptClassTests.cpp @@ -3,7 +3,7 @@ #include "../../src/Battling/Pokemon/CreatePokemon.hpp" #include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../TestLibrary/TestLibrary.hpp" +#include "../../TestLibrary/TestLibrary.hpp" #define AS_CLASS(name, contents) \ { \ diff --git a/tests/ScriptTests/Angelscript/ItemUseScriptTests.cpp b/tests/ScriptTests/Angelscript/ItemUseScriptTests.cpp index 73bc834..b304cab 100644 --- a/tests/ScriptTests/Angelscript/ItemUseScriptTests.cpp +++ b/tests/ScriptTests/Angelscript/ItemUseScriptTests.cpp @@ -2,7 +2,7 @@ #include #include "../../src/Battling/Pokemon/CreatePokemon.hpp" #include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" -#include "../TestLibrary/TestLibrary.hpp" +#include "../../TestLibrary/TestLibrary.hpp" #define AS_CLASS(name, contents) \ { #name, "namespace Pokemon{ [ItemUse effect=" #name "] class " #name " : ItemUseScript { " contents "}}" } diff --git a/tests/ScriptTests/Angelscript/ScriptOwnerTest.cpp b/tests/ScriptTests/Angelscript/ScriptOwnerTest.cpp index 2cea1c3..6653ce6 100644 --- a/tests/ScriptTests/Angelscript/ScriptOwnerTest.cpp +++ b/tests/ScriptTests/Angelscript/ScriptOwnerTest.cpp @@ -3,7 +3,7 @@ #include "../../src/Battling/Pokemon/CreatePokemon.hpp" #include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../TestLibrary/TestLibrary.hpp" +#include "../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"basic_ownership_test", diff --git a/tests/ScriptTests/Angelscript/ScriptResolverTests.cpp b/tests/ScriptTests/Angelscript/ScriptResolverTests.cpp index e908e63..0bdc8c3 100644 --- a/tests/ScriptTests/Angelscript/ScriptResolverTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptResolverTests.cpp @@ -2,7 +2,7 @@ #include #include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../TestLibrary/TestLibrary.hpp" +#include "../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/BattleTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/BattleTests.cpp index 1351cb2..9317f52 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/BattleTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/BattleTests.cpp @@ -4,7 +4,7 @@ #include "../../../../src/Battling/Pokemon/CreatePokemon.hpp" #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/PokemonTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/PokemonTests.cpp index 50973ab..6b773e5 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/PokemonTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Battle/PokemonTests.cpp @@ -3,7 +3,7 @@ #include "../../../../src/Battling/Pokemon/CreatePokemon.hpp" #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/FormesTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/FormesTests.cpp index 158fc40..eefc507 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/FormesTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/FormesTests.cpp @@ -2,7 +2,7 @@ #include #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/ItemDataTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/ItemDataTests.cpp index 9bef743..22bac27 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/ItemDataTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/ItemDataTests.cpp @@ -2,7 +2,7 @@ #include #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/MoveTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/MoveTests.cpp index 4c0f8dd..69af80e 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/MoveTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/MoveTests.cpp @@ -2,7 +2,7 @@ #include #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/SpeciesTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/SpeciesTests.cpp index 1fc7cb6..b95256d 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/SpeciesTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/SpeciesTests.cpp @@ -2,7 +2,7 @@ #include #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"( diff --git a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/StaticLibraryTests.cpp b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/StaticLibraryTests.cpp index 63a2234..982158a 100644 --- a/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/StaticLibraryTests.cpp +++ b/tests/ScriptTests/Angelscript/ScriptTypeTests/Library/StaticLibraryTests.cpp @@ -2,7 +2,7 @@ #include #include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../../../../src/ScriptResolving/AngelScript/ContextPool.hpp" -#include "../../../TestLibrary/TestLibrary.hpp" +#include "../../../../TestLibrary/TestLibrary.hpp" static std::unordered_map _scripts = std::unordered_map{{"testScript1", R"(