1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 18:32:44 +01:00

rwlib/rwengine: make use of RW_ASSERT instead of assert

This commit is contained in:
Anonymous Maarten 2017-09-12 18:38:06 +02:00 committed by Daniel Evans
parent a1333360c5
commit 02c60311ee
6 changed files with 9 additions and 11 deletions

View File

@ -1,9 +1,10 @@
#include <TextureArchive.hpp>
#include <cassert>
#include <cstring>
#include <iostream>
#include "rw/defines.hpp"
namespace RW {
std::unique_ptr<TextureArchive> TextureArchive::create(
@ -12,7 +13,7 @@ std::unique_ptr<TextureArchive> TextureArchive::create(
auto section = binaryStream.rootHeader;
assert(section->ID == BinaryStream::TEXTURE_DICTIONARY &&
RW_ASSERT(section->ID == BinaryStream::TEXTURE_DICTIONARY &&
"BinaryStream passed to this function must be a TEXTURE DICTIONARY");
// Struct

View File

@ -535,7 +535,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
BlockDword scriptVarCount;
READ_SIZE(scriptVarCount)
assert(scriptVarCount == state.script->getFile()->getGlobalsSize());
RW_ASSERT(scriptVarCount == state.script->getFile()->getGlobalsSize());
if (fread(state.script->getGlobals(), sizeof(SCMByte), scriptVarCount,
loadFile) != scriptVarCount) {

View File

@ -50,7 +50,6 @@ void GenericDATLoader::loadDynamicObjects(const std::string& name,
if (ss.peek() == ',') ss.ignore(1);
ss >> dyndata->cameraAvoid;
assert(ss.eof() || ss.good());
RW_CHECK(ss.eof() || ss.good(), "Loading dynamicsObject data file " << name << " failed");
data.insert({dyndata->modelName, dyndata});
@ -118,7 +117,6 @@ void GenericDATLoader::loadWeapons(const std::string& name,
ss >> data->modelID;
ss >> data->flags;
assert(ss.eof() || ss.good());
RW_CHECK(ss.eof() || ss.good(), "Loading weapon data file " << name << " failed");
data->inventorySlot = slotNum++;
@ -174,7 +172,6 @@ void GenericDATLoader::loadHandling(const std::string& name,
ss >> info.suspensionBias;
ss >> std::hex >> info.flags;
assert(ss.eof() || ss.good());
RW_CHECK(ss.eof() || ss.good(), "Loading handling data file " << name << " failed");
auto mit = vehicleData.find(info.ID);

View File

@ -83,6 +83,5 @@ void LoaderCutsceneDAT::load(CutsceneTracks &tracks, FileHandle file) {
tracks.duration = std::max(t, tracks.duration);
}
assert(ss.eof() || ss.good());
RW_CHECK(ss.eof() || ss.good(), "Loading CutsceneDAT file failed");
}

View File

@ -411,7 +411,7 @@ void OpenGLRenderer::pushDebugGroup(const std::string& title) {
glGetQueryObjectui64v(debugQuery, GL_QUERY_RESULT, &prof.timerStart);
currentDebugDepth++;
assert(currentDebugDepth < MAX_DEBUG_DEPTH);
RW_ASSERT(currentDebugDepth < MAX_DEBUG_DEPTH);
}
#else
RW_UNUSED(title);
@ -423,7 +423,7 @@ const Renderer::ProfileInfo& OpenGLRenderer::popDebugGroup() {
if (ogl_ext_KHR_debug) {
glPopDebugGroup();
currentDebugDepth--;
assert(currentDebugDepth >= 0);
RW_ASSERT(currentDebugDepth >= 0);
ProfileInfo& prof = profileInfo[currentDebugDepth];

View File

@ -3,9 +3,10 @@
#include <cstdint>
#include <glm/glm.hpp>
#include <cassert>
#include <cstddef>
#include "rw/defines.hpp"
/**
* @brief Class for working with RenderWare binary streams.
*
@ -339,7 +340,7 @@ public:
BinaryStreamSection getNextChildSection(size_t& internalOffset) {
size_t realOffset = internalOffset;
assert(realOffset < header.size);
RW_ASSERT(realOffset < header.size);
BinaryStreamSection sec(data,
offset + sizeof(BSSectionHeader) + realOffset);
internalOffset += sec.header.size + sizeof(BSSectionHeader);