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

This commit is contained in:
2020-12-13 12:32:52 +01:00
parent ecf8582c59
commit bbb2691b91
18 changed files with 152 additions and 164 deletions

View File

@@ -111,7 +111,7 @@ void AngelScriptResolver::RegisterTypes() {
RegisterBattleClass::Register(_engine);
[[maybe_unused]] int r = _engine->RegisterObjectMethod("Pokemon", "const Battle@ get_Battle() const property",
asFUNCTION(GetBattleWrapper), asCALL_CDECL_OBJFIRST);
assert(r >= 0);
Ensure(r >= 0);
// Register base script
BasicScriptClass::Register(_engine);
@@ -223,7 +223,7 @@ void AngelScriptResolver::WriteByteCodeToFile(const char* file, bool stripDebugI
// Open file in write binary mode.
wFile = fopen(file, "wb");
// Ensure we opened it.
AssertNotNull(wFile);
EnsureNotNull(wFile);
// Save the initial position, as we need to write here later.
fpos_t startPos;
fgetpos(wFile, &startPos);
@@ -248,7 +248,7 @@ void AngelScriptResolver::WriteByteCodeToFile(const char* file, bool stripDebugI
fwrite(byteCodeSizeArr, sizeof(uint64_t), 1, wFile);
// Close the file
Assert(fclose(wFile) == 0);
Ensure(fclose(wFile) == 0);
delete stream;
}
void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
@@ -256,7 +256,7 @@ void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
// Open the file in read binary mode
rFile = fopen(file, "rb");
// Ensure it opened
AssertNotNull(rFile);
EnsureNotNull(rFile);
// the first 8 bytes are position of the types database, everything before that is the angelscript byte code.
uint64_t byteCodeSize[]{0};
fread(byteCodeSize, sizeof(uint64_t), 1, rFile);
@@ -265,13 +265,13 @@ void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
// And load the angelscript byte code.
int result = _mainModule->LoadByteCode(stream);
// Ensure we succeeded in this.
Assert(result == asSUCCESS);
Ensure(result == asSUCCESS);
// Begin loading the type database
auto types = stream->ReadTypes();
InitializeByteCode(types);
Assert(fclose(rFile) == 0);
Ensure(fclose(rFile) == 0);
delete stream;
}
uint8_t* AngelScriptResolver::WriteByteCodeToMemory(size_t& size, bool stripDebugInfo) {
@@ -279,7 +279,7 @@ uint8_t* AngelScriptResolver::WriteByteCodeToMemory(size_t& size, bool stripDebu
size_t byteCodeSize[]{0};
stream->Write(byteCodeSize, sizeof(uint64_t));
auto result = _mainModule->SaveByteCode(stream, stripDebugInfo);
Assert(result == asSUCCESS);
Ensure(result == asSUCCESS);
byteCodeSize[0] = (uint64_t)stream->GetWrittenSize();
stream->WriteTypes(_typeDatabase);
stream->WriteToPosition(byteCodeSize, sizeof(uint64_t), 0);
@@ -297,7 +297,7 @@ void AngelScriptResolver::LoadByteCodeFromMemory(uint8_t* byte, size_t size) {
// And load the angelscript byte code.
int result = _mainModule->LoadByteCode(stream);
// Ensure we succeeded in this.
Assert(result == asSUCCESS);
Ensure(result == asSUCCESS);
// Begin loading the type database
auto types = stream->ReadTypes();