From cd4893936ecdf4d75377dea59b0aeb08bfea618a Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 16 Aug 2020 11:22:43 +0200 Subject: [PATCH] Link to library we use for stacktraces. --- CMakeLists.txt | 4 ++++ src/Battling/Pokemon/CreatePokemon.hpp | 4 ++-- tests/ScriptTests/BaseScriptClassTests.cpp | 5 ++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24d73fb..9c99041 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,10 @@ add_library(pkmnLib ${LIBTYPE} ${CORE_SRC_FILES}) SET(_LINKS CreatureLib Arbutils) SET(_TESTLINKS pkmnLib CreatureLib Arbutils) +if (NOT WINDOWS) + set(_LINKS ${_LINKS} -lbfd -ldl) +endif () + if (SCRIPT_PROVIDER STREQUAL "angelscript") message(STATUS "Using Angelscript as script provider.") diff --git a/src/Battling/Pokemon/CreatePokemon.hpp b/src/Battling/Pokemon/CreatePokemon.hpp index 6ac1860..ae42239 100644 --- a/src/Battling/Pokemon/CreatePokemon.hpp +++ b/src/Battling/Pokemon/CreatePokemon.hpp @@ -49,8 +49,8 @@ namespace PkmnLib::Battling { public: CreatePokemon(const BattleLibrary* library, const ArbUt::StringView& species, uint8_t level) - : _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalAttacks()) { - } + : _library(library), _species(species), _level(level), + _attacks(library->GetSettings()->GetMaximalAttacks()) {} CreatePokemon& WithForme(const ArbUt::StringView& forme); CreatePokemon& WithGender(CreatureLib::Library::Gender gender); diff --git a/tests/ScriptTests/BaseScriptClassTests.cpp b/tests/ScriptTests/BaseScriptClassTests.cpp index 59dae2e..ad6bd1d 100644 --- a/tests/ScriptTests/BaseScriptClassTests.cpp +++ b/tests/ScriptTests/BaseScriptClassTests.cpp @@ -344,10 +344,9 @@ TEST_CASE("Handle script exceptions.") { auto mainLib = TestLibrary::GetLibrary(); auto script = GetScript(mainLib, "throwScript"_cnc); REQUIRE(script != nullptr); - try{ + try { TryException(script); - } - catch (const ArbUt::Exception& e){ + } catch (const ArbUt::Exception& e) { REQUIRE(strcmp(e.what(), "Script exception in script 'throwScript', line 1. Message: 'test exception'.") == 0); delete script; return;