Adds math functions to Angelscript
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is failing Details

This commit is contained in:
Deukhoofd 2022-02-11 12:22:58 +01:00
parent b7c27cb1f8
commit 50feb94ca1
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 5 additions and 4 deletions

View File

@ -139,6 +139,7 @@ if (SCRIPT_PROVIDER STREQUAL "angelscript")
"${Angelscript_SOURCE_DIR}/add_on/scriptstdstring/scriptstdstring.cpp" "${Angelscript_SOURCE_DIR}/add_on/scriptstdstring/scriptstdstring.cpp"
"${Angelscript_SOURCE_DIR}/add_on/scriptdictionary/scriptdictionary.cpp" "${Angelscript_SOURCE_DIR}/add_on/scriptdictionary/scriptdictionary.cpp"
"${Angelscript_SOURCE_DIR}/add_on/scriptarray/scriptarray.cpp" "${Angelscript_SOURCE_DIR}/add_on/scriptarray/scriptarray.cpp"
"${Angelscript_SOURCE_DIR}/add_on/scriptmath/scriptmath.cpp"
"CInterface/AngelScript/*.cpp" "CInterface/AngelScript/*.cpp"
"CInterface/AngelScript/*.hpp" "CInterface/AngelScript/*.hpp"
) )
@ -203,8 +204,8 @@ endif ()
if (STATICC) if (STATICC)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
message(STATUS "Linking C library statically") message(STATUS "Linking C library statically")
set(_LINKS ${_LINKS} -static-libstdc++ -Wl,-Bstatic -lm -lgcc -lstdc++ -Wl,-Bdynamic) set(_LINKS ${_LINKS} -static-libstdc++ -Wl,-Bstatic -lgcc -lstdc++ -Wl,-Bdynamic)
SET(_TESTLINKS ${_TESTLINKS} -Wl,-Bstatic -lm -lgcc -lstdc++ -Wl,-Bdynamic) SET(_TESTLINKS ${_TESTLINKS} -Wl,-Bstatic -lgcc -lstdc++ -Wl,-Bdynamic)
endif () endif ()
target_link_libraries(pkmnLib PRIVATE ${_LINKS}) target_link_libraries(pkmnLib PRIVATE ${_LINKS})

View File

@ -6,8 +6,7 @@
#include <scripthandle/scripthandle.h> #include <scripthandle/scripthandle.h>
#include <scripthelper/scripthelper.h> #include <scripthelper/scripthelper.h>
#include <scriptstdstring/scriptstdstring.h> #include <scriptstdstring/scriptstdstring.h>
#include "../../Battling/PkmnScriptCategory.hpp" #include <scriptmath/scriptmath.h>
#include "../../Battling/Pokemon/Pokemon.hpp"
#include "AngelScriptMetadata.hpp" #include "AngelScriptMetadata.hpp"
#include "AngelscriptUserdata.hpp" #include "AngelscriptUserdata.hpp"
#include "ByteCodeHandling/FileByteCodeStream.hpp" #include "ByteCodeHandling/FileByteCodeStream.hpp"
@ -102,6 +101,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg,
RegisterScriptArray(_engine, true); RegisterScriptArray(_engine, true);
RegisterScriptHandle(_engine); RegisterScriptHandle(_engine);
RegisterScriptDictionary(_engine); RegisterScriptDictionary(_engine);
RegisterScriptMath(_engine);
r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL); r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL);
if (r < 0) if (r < 0)
throw ArbUt::Exception("Registering print function failed."); throw ArbUt::Exception("Registering print function failed.");