Update to latest CreatureLib
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-16 11:12:04 +02:00
parent d9badefb07
commit b5a1d74bdb
9 changed files with 16 additions and 13 deletions

View File

@@ -56,7 +56,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg)
int32_t r = _engine->SetMessageCallback(asFUNCTION(MessageCallback), nullptr, asCALL_CDECL);
if (r < 0)
throw CreatureException("Registering message callback failed.");
throw ArbUt::Exception("Registering message callback failed.");
_engine->SetEngineProperty(asEP_DISALLOW_EMPTY_LIST_ELEMENTS, true);
_engine->SetEngineProperty(asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE, false);
@@ -75,7 +75,7 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg)
r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL);
if (r < 0)
throw CreatureException("Registering print function failed.");
throw ArbUt::Exception("Registering print function failed.");
RegisterScriptHandle(_engine);
_builder.StartNewModule(_engine, "pkmn");
@@ -148,7 +148,7 @@ CreatureLib::Battling::Script* AngelScriptResolver::LoadScript(ScriptCategory ca
void AngelScriptResolver::FinalizeModule() {
int r = _builder.BuildModule();
if (r < 0)
throw CreatureException("Building Script Module failed.");
throw ArbUt::Exception("Building Script Module failed.");
asUINT count = _mainModule->GetObjectTypeCount();
std::regex metadataMatcher(R"(^\s*(\w+)([\w\s=]*)$)", std::regex_constants::icase);
std::regex variableMatcher(R"(\s*(\w+)=(\w+))", std::regex_constants::icase);

View File

@@ -27,14 +27,14 @@
} else { \
ctx->PopState(); \
} \
throw CreatureException(err.str()); \
throw ArbUt::Exception(err.str()); \
} \
if (newContext) { \
_ctxPool->ReturnContextToPool(ctx); \
} else { \
ctx->PopState(); \
} \
throw CreatureException("Script didn't finish properly; message " + std::to_string(scriptResult)); \
throw ArbUt::Exception("Script didn't finish properly; message " + std::to_string(scriptResult)); \
} \
if (newContext) { \
_ctxPool->ReturnContextToPool(ctx); \

View File

@@ -2,7 +2,6 @@
#define PKMNLIB_ANGELSCRIPTSCRIPT_HPP
#include <CreatureLib/Battling/ScriptHandling/Script.hpp>
#define ANGELSCRIPT_DLL_LIBRARY_IMPORT
#include <CreatureLib/Library/Exceptions/NotImplementedException.hpp>
#include <angelscript.h>
#include <cstdint>
#include "../../../extern/angelscript_addons/scriptarray/scriptarray.h"

View File

@@ -64,7 +64,7 @@ public:
ctx->Prepare(factory);
auto result = ctx->Execute();
if (result != asEXECUTION_FINISHED) {
throw CreatureException("Instantiation failed.");
throw ArbUt::Exception("Instantiation failed.");
}
asIScriptObject* obj = *(asIScriptObject**)ctx->GetAddressOfReturnValue();
obj->AddRef();

View File

@@ -30,7 +30,7 @@ public:
_capacity += MEM_STEPS;
auto newLoc = realloc(_out, _capacity * sizeof(uint8_t));
if (newLoc == nullptr) {
throw CreatureException("Out of memory.");
throw ArbUt::Exception("Out of memory.");
}
_out = (uint8_t*)newLoc;
}