From 09b1e9783a387f3831b868e5abd850ebdad90046 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sun, 15 Oct 2023 19:01:51 +0100 Subject: [PATCH] Mem fix -Data chunker was leaking, (my bad) fixed -Added != operator to scene container for std:c++17 conformance. --- Engine/source/core/dataChunker.cpp | 9 ++++++++- Engine/source/scene/sceneQueryUtil.h | 13 +++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Engine/source/core/dataChunker.cpp b/Engine/source/core/dataChunker.cpp index 90b8e2ec5..bd46c3a87 100644 --- a/Engine/source/core/dataChunker.cpp +++ b/Engine/source/core/dataChunker.cpp @@ -91,7 +91,14 @@ void DataChunker::freeBlocks(bool keepOne) mCurBlock = temp; } - if (mCurBlock) + if (!keepOne) + { + if (mCurBlock) + dFree(mCurBlock); + + mCurBlock = NULL; + } + else if (mCurBlock) { mCurBlock->curIndex = 0; mCurBlock->next = NULL; diff --git a/Engine/source/scene/sceneQueryUtil.h b/Engine/source/scene/sceneQueryUtil.h index a611f7583..d7551ff22 100644 --- a/Engine/source/scene/sceneQueryUtil.h +++ b/Engine/source/scene/sceneQueryUtil.h @@ -80,8 +80,17 @@ struct SceneBinRange inline bool operator==(const SceneBinRange& other) const { - return memcmp(minCoord, other.minCoord, sizeof(minCoord)) == 0 && - memcmp(maxCoord, other.maxCoord, sizeof(maxCoord)) == 0; + return dMemcmp(minCoord, other.minCoord, sizeof(minCoord)) == 0 && + dMemcmp(maxCoord, other.maxCoord, sizeof(maxCoord)) == 0; + } + + inline bool operator!=(const SceneBinRange& other) const + { + if (dMemcmp(minCoord, other.minCoord, sizeof(minCoord)) == 0 && + dMemcmp(maxCoord, other.maxCoord, sizeof(maxCoord)) == 0) + return false; + else + return true; } };