From 50feb94ca102d1d2a56215282ddb2bbae606ddb2 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 11 Feb 2022 12:22:58 +0100 Subject: [PATCH] Adds math functions to Angelscript --- CMakeLists.txt | 5 +++-- src/ScriptResolving/AngelScript/AngelScriptResolver.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b1044e..2312d7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,7 @@ if (SCRIPT_PROVIDER STREQUAL "angelscript") "${Angelscript_SOURCE_DIR}/add_on/scriptstdstring/scriptstdstring.cpp" "${Angelscript_SOURCE_DIR}/add_on/scriptdictionary/scriptdictionary.cpp" "${Angelscript_SOURCE_DIR}/add_on/scriptarray/scriptarray.cpp" + "${Angelscript_SOURCE_DIR}/add_on/scriptmath/scriptmath.cpp" "CInterface/AngelScript/*.cpp" "CInterface/AngelScript/*.hpp" ) @@ -203,8 +204,8 @@ endif () if (STATICC) set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") message(STATUS "Linking C library statically") - set(_LINKS ${_LINKS} -static-libstdc++ -Wl,-Bstatic -lm -lgcc -lstdc++ -Wl,-Bdynamic) - SET(_TESTLINKS ${_TESTLINKS} -Wl,-Bstatic -lm -lgcc -lstdc++ -Wl,-Bdynamic) + set(_LINKS ${_LINKS} -static-libstdc++ -Wl,-Bstatic -lgcc -lstdc++ -Wl,-Bdynamic) + SET(_TESTLINKS ${_TESTLINKS} -Wl,-Bstatic -lgcc -lstdc++ -Wl,-Bdynamic) endif () target_link_libraries(pkmnLib PRIVATE ${_LINKS}) diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp index d7c368a..24b78e7 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp @@ -6,8 +6,7 @@ #include #include #include -#include "../../Battling/PkmnScriptCategory.hpp" -#include "../../Battling/Pokemon/Pokemon.hpp" +#include #include "AngelScriptMetadata.hpp" #include "AngelscriptUserdata.hpp" #include "ByteCodeHandling/FileByteCodeStream.hpp" @@ -102,6 +101,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg, RegisterScriptArray(_engine, true); RegisterScriptHandle(_engine); RegisterScriptDictionary(_engine); + RegisterScriptMath(_engine); r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL); if (r < 0) throw ArbUt::Exception("Registering print function failed.");