From 46926ef4bf089b99e7f038032f735fb6bbaad858 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 22 Jun 2020 02:11:03 -0400 Subject: [PATCH] General: Qualify const where applicable --- src/Core/GameProject/CResourceStore.cpp | 4 ++-- src/Core/Resource/Animation/CAnimSet.h | 7 +++---- src/Core/Resource/Animation/CSourceAnimData.h | 2 +- src/Core/Resource/Animation/IMetaAnimation.cpp | 4 ++-- src/Core/Resource/CResTypeInfo.cpp | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Core/GameProject/CResourceStore.cpp b/src/Core/GameProject/CResourceStore.cpp index 3540c9d8..d46fa62b 100644 --- a/src/Core/GameProject/CResourceStore.cpp +++ b/src/Core/GameProject/CResourceStore.cpp @@ -301,7 +301,7 @@ CResourceEntry* CResourceStore::FindEntry(const CAssetID& rkID) const if (Found != mResourceEntries.cend()) { - auto& pEntry = Found->second; + const auto& pEntry = Found->second; if (!pEntry->IsMarkedForDeletion()) return pEntry.get(); @@ -450,7 +450,7 @@ CResourceEntry* CResourceStore::CreateNewResource(const CAssetID& rkID, EResourc if (IsValidResourcePath(rkDir, rkName)) { auto res = CResourceEntry::CreateNewResource(this, rkID, rkDir, rkName, Type, ExistingResource); - auto resPtr = res.get(); + auto* resPtr = res.get(); mResourceEntries.insert_or_assign(rkID, std::move(res)); mDatabaseCacheDirty = true; diff --git a/src/Core/Resource/Animation/CAnimSet.h b/src/Core/Resource/Animation/CAnimSet.h index 184d8f17..2822fb83 100644 --- a/src/Core/Resource/Animation/CAnimSet.h +++ b/src/Core/Resource/Animation/CAnimSet.h @@ -145,16 +145,15 @@ public: std::set PrimitiveSet; // Animations - for (auto& anim : mAnimations) + for (const auto& anim : mAnimations) { anim.pMetaAnim->GetUniquePrimitives(PrimitiveSet); } - CSourceAnimData *pAnimData = gpResourceStore->LoadResource(rkChar.AnimDataID); - if (pAnimData) + if (auto* pAnimData = gpResourceStore->LoadResource(rkChar.AnimDataID)) pAnimData->AddTransitionDependencies(pTree.get()); - for (auto& prim : PrimitiveSet) + for (const auto& prim : PrimitiveSet) { pTree->AddDependency(prim.Animation()); } diff --git a/src/Core/Resource/Animation/CSourceAnimData.h b/src/Core/Resource/Animation/CSourceAnimData.h index dd068a9f..3bcb8c55 100644 --- a/src/Core/Resource/Animation/CSourceAnimData.h +++ b/src/Core/Resource/Animation/CSourceAnimData.h @@ -102,7 +102,7 @@ public: break; // Add all transition primitives to the tree - for (auto& primitive : PrimSet) + for (const auto& primitive : PrimSet) pTree->AddDependency(primitive.Animation()); } } diff --git a/src/Core/Resource/Animation/IMetaAnimation.cpp b/src/Core/Resource/Animation/IMetaAnimation.cpp index a91ce7b2..f38c10c7 100644 --- a/src/Core/Resource/Animation/IMetaAnimation.cpp +++ b/src/Core/Resource/Animation/IMetaAnimation.cpp @@ -101,7 +101,7 @@ EMetaAnimType CMetaAnimRandom::Type() const void CMetaAnimRandom::GetUniquePrimitives(std::set& rPrimSet) const { - for (auto& pair : mProbabilityPairs) + for (const auto& pair : mProbabilityPairs) pair.pAnim->GetUniquePrimitives(rPrimSet); } @@ -126,6 +126,6 @@ EMetaAnimType CMetaAnimSequence::Type() const void CMetaAnimSequence::GetUniquePrimitives(std::set& rPrimSet) const { - for (auto& anim : mAnimations) + for (const auto& anim : mAnimations) anim->GetUniquePrimitives(rPrimSet); } diff --git a/src/Core/Resource/CResTypeInfo.cpp b/src/Core/Resource/CResTypeInfo.cpp index b18af4c6..f676ac7d 100644 --- a/src/Core/Resource/CResTypeInfo.cpp +++ b/src/Core/Resource/CResTypeInfo.cpp @@ -41,7 +41,7 @@ void CResTypeInfo::GetAllTypesInGame(EGame Game, std::list& rOut) { for (const auto& entry : smTypeMap) { - auto& type = entry.second; + const auto& type = entry.second; if (type->IsInGame(Game)) rOut.push_back(type.get());