From d646b896e1a76b44ce0f50cb6cce4510f10832cb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Jun 2020 19:19:59 -0400 Subject: [PATCH] CAreaLoader: Make use of in-class initializers where applicable Same behavior, less code. --- src/Core/Resource/Factory/CAreaLoader.cpp | 23 +--------- src/Core/Resource/Factory/CAreaLoader.h | 53 ++++++++++++----------- 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/src/Core/Resource/Factory/CAreaLoader.cpp b/src/Core/Resource/Factory/CAreaLoader.cpp index e9a2a6ea..cdf6efe0 100644 --- a/src/Core/Resource/Factory/CAreaLoader.cpp +++ b/src/Core/Resource/Factory/CAreaLoader.cpp @@ -9,29 +9,8 @@ #include #include -#include -CAreaLoader::CAreaLoader() - : mpMREA(nullptr) - , mHasDecompressedBuffer(false) - , mGeometryBlockNum(-1) - , mScriptLayerBlockNum(-1) - , mCollisionBlockNum(-1) - , mUnknownBlockNum(-1) - , mLightsBlockNum(-1) - , mVisiBlockNum(-1) - , mPathBlockNum(-1) - , mOctreeBlockNum(-1) - , mScriptGeneratorBlockNum(-1) - , mFFFFBlockNum(-1) - , mPTLABlockNum(-1) - , mEGMCBlockNum(-1) - , mBoundingBoxesBlockNum(-1) - , mDependenciesBlockNum(-1) - , mGPUBlockNum(-1) - , mRSOBlockNum(-1) -{ -} +CAreaLoader::CAreaLoader() = default; CAreaLoader::~CAreaLoader() { diff --git a/src/Core/Resource/Factory/CAreaLoader.h b/src/Core/Resource/Factory/CAreaLoader.h index 95c81990..8c940645 100644 --- a/src/Core/Resource/Factory/CAreaLoader.h +++ b/src/Core/Resource/Factory/CAreaLoader.h @@ -15,41 +15,44 @@ class CAreaLoader // Area data TResPtr mpArea; - IInputStream *mpMREA; - CSectionMgrIn *mpSectionMgr; - EGame mVersion; - uint32 mNumMeshes; - uint32 mNumLayers; + IInputStream *mpMREA = nullptr; + CSectionMgrIn *mpSectionMgr = nullptr; + EGame mVersion{}; + uint32 mNumMeshes = 0; + uint32 mNumLayers = 0; // Object connections std::unordered_map> mConnectionMap; // Compression - uint8 *mpDecmpBuffer; - bool mHasDecompressedBuffer; + uint8 *mpDecmpBuffer = nullptr; + bool mHasDecompressedBuffer = false; std::vector mClusters; - uint32 mTotalDecmpSize; + uint32 mTotalDecmpSize = 0; // Block numbers - uint32 mGeometryBlockNum; - uint32 mScriptLayerBlockNum; - uint32 mCollisionBlockNum; - uint32 mUnknownBlockNum; - uint32 mLightsBlockNum; - uint32 mVisiBlockNum; - uint32 mPathBlockNum; - uint32 mOctreeBlockNum; - uint32 mScriptGeneratorBlockNum; - uint32 mFFFFBlockNum; - uint32 mPTLABlockNum; - uint32 mEGMCBlockNum; - uint32 mBoundingBoxesBlockNum; - uint32 mDependenciesBlockNum; - uint32 mGPUBlockNum; - uint32 mRSOBlockNum; + uint32 mGeometryBlockNum = UINT32_MAX; + uint32 mScriptLayerBlockNum = UINT32_MAX; + uint32 mCollisionBlockNum = UINT32_MAX; + uint32 mUnknownBlockNum = UINT32_MAX; + uint32 mLightsBlockNum = UINT32_MAX; + uint32 mVisiBlockNum = UINT32_MAX; + uint32 mPathBlockNum = UINT32_MAX; + uint32 mOctreeBlockNum = UINT32_MAX; + uint32 mScriptGeneratorBlockNum = UINT32_MAX; + uint32 mFFFFBlockNum = UINT32_MAX; + uint32 mPTLABlockNum = UINT32_MAX; + uint32 mEGMCBlockNum = UINT32_MAX; + uint32 mBoundingBoxesBlockNum = UINT32_MAX; + uint32 mDependenciesBlockNum = UINT32_MAX; + uint32 mGPUBlockNum = UINT32_MAX; + uint32 mRSOBlockNum = UINT32_MAX; struct SCompressedCluster { - uint32 BufferSize, DecompressedSize, CompressedSize, NumSections; + uint32 BufferSize; + uint32 DecompressedSize; + uint32 CompressedSize; + uint32 NumSections; }; CAreaLoader();