Update to latest Arbutils, include stacktrace.
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-08-15 15:10:48 +02:00
parent 46ab060b99
commit c921d3127b
8 changed files with 104 additions and 78 deletions

View File

@@ -22,7 +22,7 @@ export bool CreatureLib_ExecutingAttack_IsCreatureTarget(ExecutingAttack* p, Cre
}
export uint8_t CreatureLib_ExecutingAttack_GetTargetCount(ExecutingAttack* p) { return p->GetTargetCount(); }
export const Creature* const* CreatureLib_ExecutingAttack_GetTargets(ExecutingAttack* p) {
return reinterpret_cast<const Creature* const*>(p->GetTargets());
return reinterpret_cast<const Creature* const*>(p->GetTargets().RawData());
}
export Creature* CreatureLib_ExecutingAttack_GetUser(ExecutingAttack* p) { return p->GetUser().GetRaw(); }

View File

@@ -1,6 +1,7 @@
#ifndef CREATURELIB_CORE_HPP
#define CREATURELIB_CORE_HPP
#include <Arbutils/Exception.hpp>
#include <cstring>
#include <exception>
#include <sstream>
@@ -14,6 +15,12 @@ class ExceptionHandler {
static std::string _creatureLibLastException;
public:
static void SetLastException(std::string function, const ArbUt::Exception& e) {
std::stringstream ss;
ss << "[" << function << "] " << e.what() << std::endl;
ss << e.GetStacktrace();
_creatureLibLastException = ss.str();
}
static void SetLastException(std::string function, const std::exception& e) {
std::stringstream ss;
ss << "[" << function << "] " << e.what();
@@ -26,6 +33,9 @@ public:
try { \
data; \
return 0; \
} catch (const ArbUt::Exception& e) { \
ExceptionHandler::SetLastException(__FUNCTION__, e); \
return CreatureLibException; \
} catch (const std::exception& e) { \
ExceptionHandler::SetLastException(__FUNCTION__, e); \
return CreatureLibException; \