Update to latest CreatureLib
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d9badefb07
commit
b5a1d74bdb
|
@ -12,6 +12,10 @@ option(TESTS "Whether the test executable should be build as well." OFF)
|
|||
option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
|
||||
set(SCRIPT_PROVIDER "angelscript" CACHE STRING "Which script provider to use.")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-fconcepts)
|
||||
endif ()
|
||||
|
||||
if (WINDOWS)
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
ADD_DEFINITIONS(-D WINDOWS=1)
|
||||
|
|
|
@ -34,7 +34,7 @@ float PkmnLib::Battling::StatCalculator::GetStatBoostModifier(const CreatureLib:
|
|||
case 4: return 6.0 / 2;
|
||||
case 5: return 7.0 / 2;
|
||||
case 6: return 8.0 / 2;
|
||||
default: throw CreatureException("Stat boost was out of expected range of -6 till 6.");
|
||||
default: throw ArbUt::Exception("Stat boost was out of expected range of -6 till 6.");
|
||||
}
|
||||
}
|
||||
CreatureLib::Library::StatisticSet<uint32_t>
|
||||
|
|
|
@ -40,13 +40,13 @@ namespace PkmnLib::Battling {
|
|||
if (!this->_library->GetSpeciesLibrary()->TryGet(this->_species, species)) {
|
||||
std::stringstream err;
|
||||
err << "Invalid species '" << _species << "'.";
|
||||
throw CreatureException(err.str());
|
||||
throw ArbUt::Exception(err.str());
|
||||
}
|
||||
ArbUt::BorrowedPtr<const PkmnLib::Library::PokemonForme> forme;
|
||||
if (!species->TryGetForme(this->_forme, forme)) {
|
||||
std::stringstream err;
|
||||
err << "Invalid forme '" << _forme << "' for species '" << _forme << "'.";
|
||||
throw CreatureException(err.str());
|
||||
throw ArbUt::Exception(err.str());
|
||||
}
|
||||
AssertNotNull(forme);
|
||||
CreatureLib::Library::TalentIndex ability;
|
||||
|
@ -151,7 +151,7 @@ namespace PkmnLib::Battling {
|
|||
THROW_CREATURE("Invalid Move given: " << moveName.std_str());
|
||||
}
|
||||
if (_currentMove >= _library->GetSettings()->GetMaximalAttacks()) {
|
||||
throw CreatureException("This pokemon already has the maximal allowed moves.");
|
||||
throw ArbUt::Exception("This pokemon already has the maximal allowed moves.");
|
||||
}
|
||||
Assert(move != nullptr);
|
||||
_attacks.Append(ToLearnMethod(move, method));
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace PkmnLib::Library {
|
|||
return v.first;
|
||||
}
|
||||
}
|
||||
throw CreatureException("Nature not found.");
|
||||
throw ArbUt::Exception("Nature not found.");
|
||||
}
|
||||
|
||||
size_t GetNatureCount() const noexcept { return _items.size(); }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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); \
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue