浏览代码

Mem fix

-Data chunker was leaking, (my bad) fixed

-Added != operator to scene container for std:c++17 conformance.
marauder2k7 1 年之前
父节点
当前提交
09b1e9783a
共有 2 个文件被更改,包括 19 次插入3 次删除
  1. 8 1
      Engine/source/core/dataChunker.cpp
  2. 11 2
      Engine/source/scene/sceneQueryUtil.h

+ 8 - 1
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;

+ 11 - 2
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;
    }
 };