From 012da6fb6d31058e206b7b2b713bc87c95b6473a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 11 Jun 2020 14:10:22 -0400 Subject: [PATCH] General: Remove unnecessary inline specifiers and add overrides --- src/Core/CLightParameters.h | 4 +- src/Core/CMayaSpline.h | 22 +- src/Core/GameProject/CDependencyTree.h | 97 +++--- src/Core/GameProject/CGameExporter.h | 4 +- src/Core/GameProject/CGameProject.h | 46 +-- src/Core/GameProject/COpeningBanner.h | 2 +- src/Core/GameProject/CPackage.h | 24 +- src/Core/GameProject/CResourceEntry.h | 40 +-- src/Core/GameProject/CResourceStore.h | 30 +- src/Core/GameProject/CVirtualDirectory.h | 16 +- src/Core/GameProject/DependencyListBuilders.h | 32 +- src/Core/IProgressNotifier.h | 14 +- src/Core/IUIRelay.h | 1 + src/Core/OpenGL/CFramebuffer.h | 2 +- src/Core/OpenGL/CRenderbuffer.h | 30 +- src/Core/OpenGL/CShader.h | 2 +- src/Core/OpenGL/CUniformBuffer.h | 4 +- src/Core/OpenGL/CVertexArrayManager.h | 2 +- src/Core/OpenGL/CVertexBuffer.cpp | 7 +- src/Core/OpenGL/CVertexBuffer.h | 10 +- src/Core/Render/CRenderBucket.h | 15 +- src/Core/Render/IRenderable.h | 4 +- src/Core/Render/SViewInfo.h | 29 +- src/Core/Resource/Animation/CSkeleton.h | 17 +- src/Core/Resource/Animation/CSkin.h | 2 +- src/Core/Resource/Animation/CSourceAnimData.h | 4 +- src/Core/Resource/Animation/IMetaAnimation.h | 43 +-- src/Core/Resource/Animation/IMetaTransition.h | 20 +- src/Core/Resource/Area/CGameArea.h | 42 +-- src/Core/Resource/CFont.h | 8 +- src/Core/Resource/CLight.h | 20 +- src/Core/Resource/CMapArea.h | 6 +- src/Core/Resource/CMaterial.h | 50 +-- src/Core/Resource/CMaterialPass.h | 34 +-- src/Core/Resource/CMaterialSet.h | 7 +- src/Core/Resource/CPoiToWorld.h | 10 +- src/Core/Resource/CResTypeFilter.h | 16 +- src/Core/Resource/CResTypeInfo.h | 10 +- src/Core/Resource/CResource.h | 28 +- src/Core/Resource/CSavedStateID.h | 10 +- src/Core/Resource/CStringList.h | 6 +- src/Core/Resource/CTexture.cpp | 24 +- src/Core/Resource/CTexture.h | 27 +- src/Core/Resource/CWorld.h | 36 +-- .../Resource/Collision/CCollidableOBBTree.h | 4 +- .../Resource/Collision/CCollisionMaterial.h | 2 +- src/Core/Resource/Collision/CCollisionMesh.h | 8 +- .../Resource/Collision/CCollisionMeshGroup.h | 12 +- .../Resource/Collision/CCollisionRenderData.h | 12 +- src/Core/Resource/Cooker/CPoiToWorldCooker.h | 3 +- src/Core/Resource/Cooker/CResourceCooker.h | 2 +- src/Core/Resource/Cooker/CScanCooker.h | 2 +- src/Core/Resource/Cooker/CScriptCooker.h | 2 +- src/Core/Resource/Cooker/CSectionMgrOut.h | 12 +- src/Core/Resource/Cooker/CStringCooker.h | 2 +- src/Core/Resource/Cooker/CTextureEncoder.cpp | 5 +- src/Core/Resource/Cooker/CTextureEncoder.h | 6 +- src/Core/Resource/Factory/CPoiToWorldLoader.h | 2 +- src/Core/Resource/Factory/CScanLoader.h | 2 +- src/Core/Resource/Factory/CSectionMgrIn.h | 20 +- src/Core/Resource/Factory/CSkeletonLoader.h | 4 +- src/Core/Resource/Factory/CSkinLoader.h | 3 +- src/Core/Resource/Factory/CStringLoader.h | 6 +- .../Factory/CUnsupportedFormatLoader.h | 4 +- .../Factory/CUnsupportedParticleLoader.h | 4 +- src/Core/Resource/Factory/CWorldLoader.h | 2 +- src/Core/Resource/Model/CModel.h | 8 +- src/Core/Resource/Model/CStaticModel.cpp | 10 +- src/Core/Resource/Model/CStaticModel.h | 10 +- src/Core/Resource/Model/CVertex.h | 14 +- src/Core/Resource/Model/SSurface.h | 14 +- src/Core/Resource/Scan/CScan.h | 4 +- src/Core/Resource/Script/CGameTemplate.h | 26 +- src/Core/Resource/Script/CLink.h | 44 ++- src/Core/Resource/Script/CScriptLayer.h | 28 +- src/Core/Resource/Script/CScriptObject.cpp | 3 - src/Core/Resource/Script/CScriptObject.h | 28 +- src/Core/Resource/Script/CScriptTemplate.cpp | 32 +- src/Core/Resource/Script/CScriptTemplate.h | 68 ++--- src/Core/Resource/Script/NPropertyMap.h | 2 +- .../Resource/Script/Property/IProperty.cpp | 11 +- src/Core/Resource/Script/Property/IProperty.h | 284 ++++++++---------- .../Resource/Script/Property/TPropertyRef.h | 60 ++-- src/Core/Resource/StringTable/CStringTable.h | 22 +- src/Core/SRayIntersection.h | 14 +- src/Core/Scene/CCollisionNode.h | 12 +- src/Core/Scene/CLightNode.h | 22 +- src/Core/Scene/CModelNode.h | 38 +-- src/Core/Scene/CRootNode.h | 13 +- src/Core/Scene/CSceneIterator.h | 16 +- src/Core/Scene/CScriptAttachNode.h | 16 +- src/Core/Scene/CScriptNode.cpp | 4 - src/Core/Scene/CScriptNode.h | 53 ++-- src/Core/Scene/CStaticNode.h | 16 +- .../ScriptExtra/CDamageableTriggerExtra.h | 18 +- src/Core/ScriptExtra/CDoorExtra.h | 14 +- src/Core/ScriptExtra/CPointOfInterestExtra.h | 4 +- src/Core/ScriptExtra/CRadiusSphereExtra.h | 6 +- src/Core/ScriptExtra/CScriptExtra.h | 16 +- src/Core/ScriptExtra/CSpacePirateExtra.h | 4 +- src/Core/ScriptExtra/CSplinePathExtra.h | 10 +- src/Core/ScriptExtra/CWaypointExtra.cpp | 2 - src/Core/ScriptExtra/CWaypointExtra.h | 6 +- src/Core/Tweaks/CTweakCooker.h | 2 +- src/Core/Tweaks/CTweakData.h | 6 +- src/Core/Tweaks/CTweakLoader.h | 2 +- src/Core/Tweaks/CTweakManager.h | 2 +- 107 files changed, 885 insertions(+), 1055 deletions(-) diff --git a/src/Core/CLightParameters.h b/src/Core/CLightParameters.h index 1a5ffd52..ee63bf7a 100644 --- a/src/Core/CLightParameters.h +++ b/src/Core/CLightParameters.h @@ -35,12 +35,12 @@ public: } } - inline int LightLayerIndex() const + int LightLayerIndex() const { return mLightLayer.IsValid() ? mLightLayer.Get() : 0; } - inline EWorldLightingOptions WorldLightingOptions() const + EWorldLightingOptions WorldLightingOptions() const { return mWorldLightingOptions.IsValid() ? mWorldLightingOptions.Get() : eNormalLighting; } diff --git a/src/Core/CMayaSpline.h b/src/Core/CMayaSpline.h index bee86756..bae74d16 100644 --- a/src/Core/CMayaSpline.h +++ b/src/Core/CMayaSpline.h @@ -22,21 +22,21 @@ public: class CMayaSpline { - uint mPreInfinity; // 0x00 - uint mPostInfinity; // 0x04 + uint mPreInfinity = 0; // 0x00 + uint mPostInfinity = 0; // 0x04 std::vector mKnots; // 0x08, 0x0C, 0x10 - uint mClampMode; // 0x14 - clamp mode - float mMinAmplitude; // 0x18 - float mMaxAmplitude; // 0x1C + uint mClampMode = 0; // 0x14 - clamp mode + float mMinAmplitude = 0.0f; // 0x18 + float mMaxAmplitude = 0.0f; // 0x1C - mutable int mCachedKnotIndex; // 0x20 - mutable int mUnknown1; // 0x24 - mutable uint8 mDirtyFlags; // 0x28 - mutable float mCachedMinTime; // 0x2C - mutable float mCachedHermiteCoefficients[4]; // 0x30, 0x34, 0x38, 0x3C + mutable int mCachedKnotIndex = 0; // 0x20 + mutable int mUnknown1 = 0; // 0x24 + mutable uint8 mDirtyFlags = 0; // 0x28 + mutable float mCachedMinTime = 0.0f; // 0x2C + mutable float mCachedHermiteCoefficients[4] = {}; // 0x30, 0x34, 0x38, 0x3C public: - CMayaSpline() {} + CMayaSpline() = default; uint GetKnotCount() const; const std::vector& GetKnots() const; float GetMinTime() const; diff --git a/src/Core/GameProject/CDependencyTree.h b/src/Core/GameProject/CDependencyTree.h index 68b4d775..0a61abf5 100644 --- a/src/Core/GameProject/CDependencyTree.h +++ b/src/Core/GameProject/CDependencyTree.h @@ -45,18 +45,18 @@ public: static IDependencyNode* ArchiveConstructor(EDependencyNodeType Type); // Accessors - inline uint NumChildren() const { return mChildren.size(); } - inline IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; } + uint NumChildren() const { return mChildren.size(); } + IDependencyNode* ChildByIndex(uint Index) const { return mChildren[Index]; } }; // Basic dependency tree; this class is sufficient for most resource types. class CDependencyTree : public IDependencyNode { public: - CDependencyTree() {} + CDependencyTree() = default; - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; void AddChild(IDependencyNode *pNode); void AddDependency(const CAssetID& rkID, bool AvoidDuplicates = true); @@ -71,17 +71,17 @@ protected: CAssetID mID; public: - CResourceDependency() {} + CResourceDependency() = default; CResourceDependency(const CAssetID& rkID) : mID(rkID) {} - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); - virtual void GetAllResourceReferences(std::set& rOutSet) const; - virtual bool HasDependency(const CAssetID& rkID) const; + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; + void GetAllResourceReferences(std::set& rOutSet) const override; + bool HasDependency(const CAssetID& rkID) const override; // Accessors - inline CAssetID ID() const { return mID; } - inline void SetID(const CAssetID& rkID) { mID = rkID; } + CAssetID ID() const { return mID; } + void SetID(const CAssetID& rkID) { mID = rkID; } }; // Node representing a single resource dependency referenced by a script property. @@ -90,58 +90,53 @@ class CPropertyDependency : public CResourceDependency TString mIDString; public: - CPropertyDependency() - : CResourceDependency() - {} + CPropertyDependency() = default; CPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID) : CResourceDependency(rkAssetID) , mIDString(rkPropID) {} - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; // Accessors - inline TString PropertyID() const { return mIDString; } + TString PropertyID() const { return mIDString; } }; // Node representing a single animset dependency referenced by a script property. Indicates which character is being used. class CCharPropertyDependency : public CPropertyDependency { protected: - int mUsedChar; + int mUsedChar = -1; public: - CCharPropertyDependency() - : CPropertyDependency() - , mUsedChar(-1) - {} + CCharPropertyDependency() = default; CCharPropertyDependency(const TString& rkPropID, const CAssetID& rkAssetID, int UsedChar) : CPropertyDependency(rkPropID, rkAssetID) , mUsedChar(UsedChar) {} - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; // Accessors - inline int UsedChar() const { return mUsedChar; } + int UsedChar() const { return mUsedChar; } }; // Node representing a script object. Indicates the type of object. class CScriptInstanceDependency : public IDependencyNode { protected: - uint mObjectType; + uint mObjectType = 0; public: - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; // Accessors - inline uint ObjectType() const { return mObjectType; } + uint ObjectType() const { return mObjectType; } // Static static CScriptInstanceDependency* BuildTree(CScriptObject *pInstance); @@ -151,17 +146,17 @@ public: class CSetCharacterDependency : public CDependencyTree { protected: - uint32 mCharSetIndex; + uint32 mCharSetIndex = 0; public: - CSetCharacterDependency() : CDependencyTree() {} - CSetCharacterDependency(uint32 SetIndex) : CDependencyTree(), mCharSetIndex(SetIndex) {} + CSetCharacterDependency() = default; + CSetCharacterDependency(uint32 SetIndex) : mCharSetIndex(SetIndex) {} - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; // Accessors - inline uint32 CharSetIndex() const { return mCharSetIndex; } + uint32 CharSetIndex() const { return mCharSetIndex; } // Static static CSetCharacterDependency* BuildTree(const SSetCharacter& rkChar); @@ -174,14 +169,14 @@ protected: std::set mCharacterIndices; public: - CSetAnimationDependency() : CDependencyTree() {} + CSetAnimationDependency() = default; - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; // Accessors - inline bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); } - inline bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); } + bool IsUsedByCharacter(uint32 CharIdx) const { return mCharacterIndices.find(CharIdx) != mCharacterIndices.end(); } + bool IsUsedByAnyCharacter() const { return !mCharacterIndices.empty(); } // Static static CSetAnimationDependency* BuildTree(const CAnimSet *pkOwnerSet, uint32 AnimIndex); @@ -191,18 +186,18 @@ public: class CAnimEventDependency : public CResourceDependency { protected: - uint32 mCharIndex; + uint32 mCharIndex = 0; public: - CAnimEventDependency() : CResourceDependency() {} + CAnimEventDependency() = default; CAnimEventDependency(const CAssetID& rkID, uint32 CharIndex) : CResourceDependency(rkID), mCharIndex(CharIndex) {} - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; // Accessors - inline uint32 CharIndex() const { return mCharIndex; } + uint32 CharIndex() const { return mCharIndex; } }; // Node representing an area. Tracks dependencies on a per-instance basis and can separate dependencies of different script layers. @@ -212,17 +207,17 @@ protected: std::vector mLayerOffsets; public: - CAreaDependencyTree() : CDependencyTree() {} + CAreaDependencyTree() = default; - virtual EDependencyNodeType Type() const; - virtual void Serialize(IArchive& rArc); + EDependencyNodeType Type() const override; + void Serialize(IArchive& rArc) override; void AddScriptLayer(CScriptLayer *pLayer, const std::vector& rkExtraDeps); void GetModuleDependencies(EGame Game, std::vector& rModuleDepsOut, std::vector& rModuleLayerOffsetsOut) const; // Accessors - inline uint32 NumScriptLayers() const { return mLayerOffsets.size(); } - inline uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; } + uint32 NumScriptLayers() const { return mLayerOffsets.size(); } + uint32 ScriptLayerOffset(uint32 LayerIdx) const { return mLayerOffsets[LayerIdx]; } }; #endif // CDEPENDENCYTREE diff --git a/src/Core/GameProject/CGameExporter.h b/src/Core/GameProject/CGameExporter.h index 860ef6b9..0453b87d 100644 --- a/src/Core/GameProject/CGameExporter.h +++ b/src/Core/GameProject/CGameExporter.h @@ -78,7 +78,7 @@ public: void LoadResource(const CAssetID& rkID, std::vector& rBuffer); bool ShouldExportDiscNode(const nod::Node *pkNode, bool IsInRoot); - inline TString ProjectPath() const { return mProjectPath; } + TString ProjectPath() const { return mProjectPath; } protected: bool ExtractDiscData(); @@ -91,7 +91,7 @@ protected: TString MakeWorldName(CAssetID WorldID); // Convenience Functions - inline SResourceInstance* FindResourceInstance(const CAssetID& rkID) + SResourceInstance* FindResourceInstance(const CAssetID& rkID) { uint64 IntegralID = rkID.ToLongLong(); auto Found = mResourceMap.find(IntegralID); diff --git a/src/Core/GameProject/CGameProject.h b/src/Core/GameProject/CGameProject.h index 8b0dd023..e8e6189e 100644 --- a/src/Core/GameProject/CGameProject.h +++ b/src/Core/GameProject/CGameProject.h @@ -82,34 +82,34 @@ public: static CGameProject* LoadProject(const TString& rkProjPath, IProgressNotifier *pProgress); // Directory Handling - inline TString ProjectRoot() const { return mProjectRoot; } - inline TString ProjectPath() const { return mProjectRoot + FileUtil::SanitizeName(mProjectName, false) + ".prj"; } - inline TString HiddenFilesDir() const { return mProjectRoot + ".project/"; } - inline TString DiscDir(bool Relative) const { return Relative ? "Disc/" : mProjectRoot + "Disc/"; } - inline TString PackagesDir(bool Relative) const { return Relative ? "Packages/" : mProjectRoot + "Packages/"; } - inline TString ResourcesDir(bool Relative) const { return Relative ? "Resources/" : mProjectRoot + "Resources/"; } + TString ProjectRoot() const { return mProjectRoot; } + TString ProjectPath() const { return mProjectRoot + FileUtil::SanitizeName(mProjectName, false) + ".prj"; } + TString HiddenFilesDir() const { return mProjectRoot + ".project/"; } + TString DiscDir(bool Relative) const { return Relative ? "Disc/" : mProjectRoot + "Disc/"; } + TString PackagesDir(bool Relative) const { return Relative ? "Packages/" : mProjectRoot + "Packages/"; } + TString ResourcesDir(bool Relative) const { return Relative ? "Resources/" : mProjectRoot + "Resources/"; } // Disc Filesystem Management - inline TString DiscFilesystemRoot(bool Relative) const { return DiscDir(Relative) + (IsWiiBuild() ? "DATA/" : "") + "files/"; } + TString DiscFilesystemRoot(bool Relative) const { return DiscDir(Relative) + (IsWiiBuild() ? "DATA/" : "") + "files/"; } // Accessors - inline void SetProjectName(const TString& rkName) { mProjectName = rkName; } + void SetProjectName(const TString& rkName) { mProjectName = rkName; } - inline TString Name() const { return mProjectName; } - inline uint32 NumPackages() const { return mPackages.size(); } - inline CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; } - inline void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); } - inline CResourceStore* ResourceStore() const { return mpResourceStore.get(); } - inline CGameInfo* GameInfo() const { return mpGameInfo.get(); } - inline CAudioManager* AudioManager() const { return mpAudioManager.get(); } - inline CTweakManager* TweakManager() const { return mpTweakManager.get(); } - inline EGame Game() const { return mGame; } - inline ERegion Region() const { return mRegion; } - inline TString GameID() const { return mGameID; } - inline float BuildVersion() const { return mBuildVersion; } - inline bool IsWiiBuild() const { return mBuildVersion >= 3.f; } - inline bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; } - inline bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; } + TString Name() const { return mProjectName; } + uint32 NumPackages() const { return mPackages.size(); } + CPackage* PackageByIndex(uint32 Index) const { return mPackages[Index]; } + void AddPackage(CPackage *pPackage) { mPackages.push_back(pPackage); } + CResourceStore* ResourceStore() const { return mpResourceStore.get(); } + CGameInfo* GameInfo() const { return mpGameInfo.get(); } + CAudioManager* AudioManager() const { return mpAudioManager.get(); } + CTweakManager* TweakManager() const { return mpTweakManager.get(); } + EGame Game() const { return mGame; } + ERegion Region() const { return mRegion; } + TString GameID() const { return mGameID; } + float BuildVersion() const { return mBuildVersion; } + bool IsWiiBuild() const { return mBuildVersion >= 3.f; } + bool IsTrilogy() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.593f; } + bool IsWiiDeAsobu() const { return mGame <= EGame::Corruption && mBuildVersion >= 3.570f && mBuildVersion < 3.593f; } }; #endif // CGAMEPROJECT_H diff --git a/src/Core/GameProject/COpeningBanner.h b/src/Core/GameProject/COpeningBanner.h index f5745739..daf2d536 100644 --- a/src/Core/GameProject/COpeningBanner.h +++ b/src/Core/GameProject/COpeningBanner.h @@ -13,7 +13,7 @@ class COpeningBanner bool mWii; public: - COpeningBanner(CGameProject *pProj); + explicit COpeningBanner(CGameProject *pProj); TString EnglishGameName() const; void SetEnglishGameName(const TString& rkName); void Save(); diff --git a/src/Core/GameProject/CPackage.h b/src/Core/GameProject/CPackage.h index b4804420..814c1200 100644 --- a/src/Core/GameProject/CPackage.h +++ b/src/Core/GameProject/CPackage.h @@ -34,24 +34,22 @@ struct SNamedResource class CPackage { - CGameProject *mpProject; + CGameProject *mpProject = nullptr; TString mPakName; TString mPakPath; std::vector mResources; - bool mNeedsRecook; + bool mNeedsRecook = false; // Cached dependency list; used to figure out if a given resource is in this package - mutable bool mCacheDirty; + mutable bool mCacheDirty = false; mutable std::set mCachedDependencies; public: - CPackage() {} - + CPackage() = default; CPackage(CGameProject *pProj, const TString& rkName, const TString& rkPath) : mpProject(pProj) , mPakName(rkName) , mPakPath(rkPath) - , mNeedsRecook(false) , mCacheDirty(true) {} @@ -70,14 +68,14 @@ public: TString CookedPackagePath(bool Relative) const; // Accessors - inline TString Name() const { return mPakName; } - inline TString Path() const { return mPakPath; } - inline CGameProject* Project() const { return mpProject; } - inline uint32 NumNamedResources() const { return mResources.size(); } - inline const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; } - inline bool NeedsRecook() const { return mNeedsRecook; } + TString Name() const { return mPakName; } + TString Path() const { return mPakPath; } + CGameProject* Project() const { return mpProject; } + uint32 NumNamedResources() const { return mResources.size(); } + const SNamedResource& NamedResourceByIndex(uint32 Idx) const { return mResources[Idx]; } + bool NeedsRecook() const { return mNeedsRecook; } - inline void SetPakName(TString NewName) { mPakName = NewName; } + void SetPakName(TString NewName) { mPakName = std::move(NewName); } }; #endif // CPACKAGE diff --git a/src/Core/GameProject/CResourceEntry.h b/src/Core/GameProject/CResourceEntry.h index fce01af8..b519d773 100644 --- a/src/Core/GameProject/CResourceEntry.h +++ b/src/Core/GameProject/CResourceEntry.h @@ -41,7 +41,7 @@ class CResourceEntry mutable TString mCachedUppercaseName; // This is used to speed up case-insensitive sorting and filtering. // Private constructor - CResourceEntry(CResourceStore *pStore); + explicit CResourceEntry(CResourceStore *pStore); public: static CResourceEntry* CreateNewResource(CResourceStore *pStore, const CAssetID& rkID, @@ -86,27 +86,27 @@ public: void ClearFlag(EResEntryFlag Flag); // Accessors - inline void SetFlagEnabled(EResEntryFlag Flag, bool Enabled) { Enabled ? SetFlag(Flag) : ClearFlag(Flag); } + void SetFlagEnabled(EResEntryFlag Flag, bool Enabled) { Enabled ? SetFlag(Flag) : ClearFlag(Flag); } - inline void SetDirty() { SetFlag(EResEntryFlag::NeedsRecook); } - inline void SetHidden(bool Hidden) { SetFlagEnabled(EResEntryFlag::Hidden, Hidden); } - inline bool HasFlag(EResEntryFlag Flag) const { return mFlags.HasFlag(Flag); } - inline bool IsHidden() const { return HasFlag(EResEntryFlag::Hidden); } - inline bool IsMarkedForDeletion() const { return HasFlag(EResEntryFlag::MarkedForDeletion); } + void SetDirty() { SetFlag(EResEntryFlag::NeedsRecook); } + void SetHidden(bool Hidden) { SetFlagEnabled(EResEntryFlag::Hidden, Hidden); } + bool HasFlag(EResEntryFlag Flag) const { return mFlags.HasFlag(Flag); } + bool IsHidden() const { return HasFlag(EResEntryFlag::Hidden); } + bool IsMarkedForDeletion() const { return HasFlag(EResEntryFlag::MarkedForDeletion); } - inline bool IsLoaded() const { return mpResource != nullptr; } - inline bool IsCategorized() const { return mpDirectory && !mpDirectory->FullPath().CaseInsensitiveCompare( mpStore->DefaultResourceDirPath() ); } - inline bool IsNamed() const { return mName != mID.ToString(); } - inline CResource* Resource() const { return mpResource; } - inline CResTypeInfo* TypeInfo() const { return mpTypeInfo; } - inline CResourceStore* ResourceStore() const { return mpStore; } - inline CDependencyTree* Dependencies() const { return mpDependencies; } - inline CAssetID ID() const { return mID; } - inline CVirtualDirectory* Directory() const { return mpDirectory; } - inline TString DirectoryPath() const { return mpDirectory->FullPath(); } - inline TString Name() const { return mName; } - inline const TString& UppercaseName() const { return mCachedUppercaseName; } - inline EResourceType ResourceType() const { return mpTypeInfo->Type(); } + bool IsLoaded() const { return mpResource != nullptr; } + bool IsCategorized() const { return mpDirectory && !mpDirectory->FullPath().CaseInsensitiveCompare( mpStore->DefaultResourceDirPath() ); } + bool IsNamed() const { return mName != mID.ToString(); } + CResource* Resource() const { return mpResource; } + CResTypeInfo* TypeInfo() const { return mpTypeInfo; } + CResourceStore* ResourceStore() const { return mpStore; } + CDependencyTree* Dependencies() const { return mpDependencies; } + CAssetID ID() const { return mID; } + CVirtualDirectory* Directory() const { return mpDirectory; } + TString DirectoryPath() const { return mpDirectory->FullPath(); } + TString Name() const { return mName; } + const TString& UppercaseName() const { return mCachedUppercaseName; } + EResourceType ResourceType() const { return mpTypeInfo->Type(); } protected: CResource* InternalLoad(IInputStream& rInput); diff --git a/src/Core/GameProject/CResourceStore.h b/src/Core/GameProject/CResourceStore.h index f358cb45..0bff245c 100644 --- a/src/Core/GameProject/CResourceStore.h +++ b/src/Core/GameProject/CResourceStore.h @@ -20,7 +20,7 @@ enum class EDatabaseVersion // Add new versions before this line Max, - Current = EDatabaseVersion::Max - 1 + Current = Max - 1 }; class CResourceStore @@ -39,8 +39,8 @@ class CResourceStore bool mDatabasePathExists; public: - CResourceStore(const TString& rkDatabasePath); - CResourceStore(CGameProject *pProject); + explicit CResourceStore(const TString& rkDatabasePath); + explicit CResourceStore(CGameProject *pProject); ~CResourceStore(); bool SerializeDatabaseCache(IArchive& rArc); bool LoadDatabaseCache(); @@ -78,19 +78,19 @@ public: static TString StaticDefaultResourceDirPath(EGame Game); // Accessors - inline CGameProject* Project() const { return mpProj; } - inline EGame Game() const { return mGame; } - inline TString DatabaseRootPath() const { return mDatabasePath; } - inline bool DatabasePathExists() const { return mDatabasePathExists; } - inline TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; } - inline TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; } - inline CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; } - inline uint32 NumTotalResources() const { return mResourceEntries.size(); } - inline uint32 NumLoadedResources() const { return mLoadedResources.size(); } - inline bool IsCacheDirty() const { return mDatabaseCacheDirty; } + CGameProject* Project() const { return mpProj; } + EGame Game() const { return mGame; } + TString DatabaseRootPath() const { return mDatabasePath; } + bool DatabasePathExists() const { return mDatabasePathExists; } + TString ResourcesDir() const { return IsEditorStore() ? DatabaseRootPath() : DatabaseRootPath() + "Resources/"; } + TString DatabasePath() const { return DatabaseRootPath() + "ResourceDatabaseCache.bin"; } + CVirtualDirectory* RootDirectory() const { return mpDatabaseRoot; } + uint32 NumTotalResources() const { return mResourceEntries.size(); } + uint32 NumLoadedResources() const { return mLoadedResources.size(); } + bool IsCacheDirty() const { return mDatabaseCacheDirty; } - inline void SetCacheDirty() { mDatabaseCacheDirty = true; } - inline bool IsEditorStore() const { return mpProj == nullptr; } + void SetCacheDirty() { mDatabaseCacheDirty = true; } + bool IsEditorStore() const { return mpProj == nullptr; } }; extern TString gDataDir; diff --git a/src/Core/GameProject/CVirtualDirectory.h b/src/Core/GameProject/CVirtualDirectory.h index fc0550be..1c935ac3 100644 --- a/src/Core/GameProject/CVirtualDirectory.h +++ b/src/Core/GameProject/CVirtualDirectory.h @@ -19,7 +19,7 @@ class CVirtualDirectory std::vector mResources; public: - CVirtualDirectory(CResourceStore *pStore); + explicit CVirtualDirectory(CResourceStore *pStore); CVirtualDirectory(const TString& rkName, CResourceStore *pStore); CVirtualDirectory(CVirtualDirectory *pParent, const TString& rkName, CResourceStore *pStore); ~CVirtualDirectory(); @@ -48,14 +48,14 @@ public: static bool IsValidDirectoryPath(TString Path); // Accessors - inline CVirtualDirectory* Parent() const { return mpParent; } - inline bool IsRoot() const { return !mpParent; } - inline TString Name() const { return mName; } + CVirtualDirectory* Parent() const { return mpParent; } + bool IsRoot() const { return !mpParent; } + TString Name() const { return mName; } - inline uint32 NumSubdirectories() const { return mSubdirectories.size(); } - inline CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; } - inline uint32 NumResources() const { return mResources.size(); } - inline CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; } + uint32 NumSubdirectories() const { return mSubdirectories.size(); } + CVirtualDirectory* SubdirectoryByIndex(uint32 Index) { return mSubdirectories[Index]; } + uint32 NumResources() const { return mResources.size(); } + CResourceEntry* ResourceByIndex(uint32 Index) { return mResources[Index]; } }; #endif // CVIRTUALDIRECTORY diff --git a/src/Core/GameProject/DependencyListBuilders.h b/src/Core/GameProject/DependencyListBuilders.h index b7062b65..6176dbfc 100644 --- a/src/Core/GameProject/DependencyListBuilders.h +++ b/src/Core/GameProject/DependencyListBuilders.h @@ -12,14 +12,14 @@ class CCharacterUsageMap { std::map> mUsageMap; std::set mStillLookingIDs; - CResourceStore *mpStore; - uint32 mLayerIndex; - bool mIsInitialArea; - bool mCurrentAreaAllowsDupes; + CResourceStore *mpStore = nullptr; + uint32 mLayerIndex = UINT32_MAX; + bool mIsInitialArea = true; + bool mCurrentAreaAllowsDupes = false; public: - CCharacterUsageMap(CResourceStore *pStore) - : mpStore(pStore), mLayerIndex(-1), mIsInitialArea(true), mCurrentAreaAllowsDupes(false) + explicit CCharacterUsageMap(CResourceStore *pStore) + : mpStore(pStore) {} bool IsCharacterUsed(const CAssetID& rkID, uint32 CharacterIndex) const; @@ -47,19 +47,17 @@ class CPackageDependencyListBuilder std::set mPackageUsedAssets; std::set mAreaUsedAssets; std::set mUniversalAreaAssets; - bool mEnableDuplicates; - bool mCurrentAreaHasDuplicates; - bool mIsUniversalAreaAsset; - bool mIsPlayerActor; + bool mEnableDuplicates = false; + bool mCurrentAreaHasDuplicates = false; + bool mIsUniversalAreaAsset = false; + bool mIsPlayerActor = false; public: - CPackageDependencyListBuilder(const CPackage *pkPackage) + explicit CPackageDependencyListBuilder(const CPackage *pkPackage) : mpkPackage(pkPackage) - , mGame(pkPackage->Project()->Game()) , mpStore(pkPackage->Project()->ResourceStore()) + , mGame(pkPackage->Project()->Game()) , mCharacterUsageMap(pkPackage->Project()->ResourceStore()) - , mCurrentAreaHasDuplicates(false) - , mIsPlayerActor(false) { } @@ -79,10 +77,10 @@ class CAreaDependencyListBuilder CCharacterUsageMap mCharacterUsageMap; std::set mBaseUsedAssets; std::set mLayerUsedAssets; - bool mIsPlayerActor; + bool mIsPlayerActor = false; public: - CAreaDependencyListBuilder(CResourceEntry *pAreaEntry) + explicit CAreaDependencyListBuilder(CResourceEntry *pAreaEntry) : mpAreaEntry(pAreaEntry) , mpStore(pAreaEntry->ResourceStore()) , mGame(pAreaEntry->Game()) @@ -106,7 +104,7 @@ class CAssetDependencyListBuilder CAssetID mCurrentAnimSetID; public: - CAssetDependencyListBuilder(CResourceEntry* pEntry) + explicit CAssetDependencyListBuilder(CResourceEntry* pEntry) : mpResourceEntry(pEntry) , mCharacterUsageMap(pEntry->ResourceStore()) {} diff --git a/src/Core/IProgressNotifier.h b/src/Core/IProgressNotifier.h index e2dc2b06..65c83aa2 100644 --- a/src/Core/IProgressNotifier.h +++ b/src/Core/IProgressNotifier.h @@ -7,14 +7,12 @@ class IProgressNotifier { TString mTaskName; - int mTaskIndex; - int mTaskCount; + int mTaskIndex = 0; + int mTaskCount = 1; public: - IProgressNotifier() - : mTaskIndex(0) - , mTaskCount(1) - {} + IProgressNotifier() = default; + virtual ~IProgressNotifier() = default; void SetNumTasks(int NumTasks) { @@ -67,9 +65,9 @@ protected: class CNullProgressNotifier : public IProgressNotifier { public: - bool ShouldCancel() const { return false; } + bool ShouldCancel() const override{ return false; } protected: - void UpdateProgress(const TString&, const TString&, float) {} + void UpdateProgress(const TString&, const TString&, float) override {} }; extern CNullProgressNotifier *gpNullProgress; diff --git a/src/Core/IUIRelay.h b/src/Core/IUIRelay.h index 066f1290..30cf2a62 100644 --- a/src/Core/IUIRelay.h +++ b/src/Core/IUIRelay.h @@ -6,6 +6,7 @@ class IUIRelay { public: + virtual ~IUIRelay() = default; virtual void ShowMessageBox(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0; virtual void ShowMessageBoxAsync(const TString& rkInfoBoxTitle, const TString& rkMessage) = 0; virtual bool AskYesNoQuestion(const TString& rkInfoBoxTitle, const TString& rkQuestion) = 0; diff --git a/src/Core/OpenGL/CFramebuffer.h b/src/Core/OpenGL/CFramebuffer.h index cd395123..9ebccac3 100644 --- a/src/Core/OpenGL/CFramebuffer.h +++ b/src/Core/OpenGL/CFramebuffer.h @@ -28,7 +28,7 @@ public: void SetMultisamplingEnabled(bool Enable); // Accessors - inline CTexture* Texture() const { return mpTexture; } + CTexture* Texture() const { return mpTexture; } // Static static void BindDefaultFramebuffer(GLenum Target = GL_FRAMEBUFFER); diff --git a/src/Core/OpenGL/CRenderbuffer.h b/src/Core/OpenGL/CRenderbuffer.h index 00e1c0df..7e75d64e 100644 --- a/src/Core/OpenGL/CRenderbuffer.h +++ b/src/Core/OpenGL/CRenderbuffer.h @@ -6,25 +6,17 @@ class CRenderbuffer { - GLuint mRenderbuffer; - uint mWidth, mHeight; - bool mEnableMultisampling; - bool mInitialized; + GLuint mRenderbuffer = 0; + uint mWidth = 0; + uint mHeight = 0; + bool mEnableMultisampling = false; + bool mInitialized = false; public: - CRenderbuffer() - : mWidth(0) - , mHeight(0) - , mEnableMultisampling(false) - , mInitialized(false) - { - } - + CRenderbuffer() = default; CRenderbuffer(uint Width, uint Height) : mWidth(Width) , mHeight(Height) - , mEnableMultisampling(false) - , mInitialized(false) { } @@ -41,7 +33,7 @@ public: InitStorage(); } - inline void Resize(uint Width, uint Height) + void Resize(uint Width, uint Height) { mWidth = Width; mHeight = Height; @@ -50,23 +42,23 @@ public: InitStorage(); } - inline void Bind() + void Bind() { if (!mInitialized) Init(); glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer); } - inline void Unbind() + void Unbind() { glBindRenderbuffer(GL_RENDERBUFFER, 0); } - inline GLuint BufferID() + GLuint BufferID() const { return mRenderbuffer; } - inline void SetMultisamplingEnabled(bool Enable) + void SetMultisamplingEnabled(bool Enable) { if (mEnableMultisampling != Enable) { diff --git a/src/Core/OpenGL/CShader.h b/src/Core/OpenGL/CShader.h index 7165f865..f9ba7006 100644 --- a/src/Core/OpenGL/CShader.h +++ b/src/Core/OpenGL/CShader.h @@ -47,7 +47,7 @@ public: static CShader* CurrentShader(); static void KillCachedShader(); - inline static int NumShaders() { return smNumShaders; } + static int NumShaders() { return smNumShaders; } private: void CacheCommonUniforms(); diff --git a/src/Core/OpenGL/CUniformBuffer.h b/src/Core/OpenGL/CUniformBuffer.h index 04e936fc..a9142589 100644 --- a/src/Core/OpenGL/CUniformBuffer.h +++ b/src/Core/OpenGL/CUniformBuffer.h @@ -17,7 +17,7 @@ public: SetBufferSize(0); } - CUniformBuffer(uint Size) + explicit CUniformBuffer(uint Size) { glGenBuffers(1, &mUniformBuffer); SetBufferSize(Size); @@ -65,7 +65,7 @@ public: InitializeBuffer(); } - uint GetBufferSize() + uint GetBufferSize() const { return mBufferSize; } diff --git a/src/Core/OpenGL/CVertexArrayManager.h b/src/Core/OpenGL/CVertexArrayManager.h index e14f8bb4..89a24532 100644 --- a/src/Core/OpenGL/CVertexArrayManager.h +++ b/src/Core/OpenGL/CVertexArrayManager.h @@ -12,7 +12,7 @@ class CVertexArrayManager { std::unordered_map mVBOMap; std::unordered_map mDynamicVBOMap; - uint32 mVectorIndex; + uint32 mVectorIndex = 0; static std::vector sVAManagers; static CVertexArrayManager *spCurrentManager; diff --git a/src/Core/OpenGL/CVertexBuffer.cpp b/src/Core/OpenGL/CVertexBuffer.cpp index 5810dec0..25b9ad60 100644 --- a/src/Core/OpenGL/CVertexBuffer.cpp +++ b/src/Core/OpenGL/CVertexBuffer.cpp @@ -3,7 +3,6 @@ CVertexBuffer::CVertexBuffer() { - mBuffered = false; SetVertexDesc(EVertexAttribute::Position | EVertexAttribute::Normal | EVertexAttribute::Tex0 | EVertexAttribute::Tex1 | EVertexAttribute::Tex2 | EVertexAttribute::Tex3 | @@ -216,12 +215,12 @@ void CVertexBuffer::Unbind() glBindVertexArray(0); } -bool CVertexBuffer::IsBuffered() +bool CVertexBuffer::IsBuffered() const { return mBuffered; } -FVertexDescription CVertexBuffer::VertexDesc() +FVertexDescription CVertexBuffer::VertexDesc() const { return mVtxDesc; } @@ -238,7 +237,7 @@ void CVertexBuffer::SetSkin(CSkin *pSkin) mpSkin = pSkin; } -uint32 CVertexBuffer::Size() +uint32 CVertexBuffer::Size() const { return mPositions.size(); } diff --git a/src/Core/OpenGL/CVertexBuffer.h b/src/Core/OpenGL/CVertexBuffer.h index 4cc4242b..9836dc56 100644 --- a/src/Core/OpenGL/CVertexBuffer.h +++ b/src/Core/OpenGL/CVertexBuffer.h @@ -19,11 +19,11 @@ class CVertexBuffer std::vector mTexCoords[8]; // Vectors of texture coordinates std::vector mBoneIndices; // Vectors of bone indices std::vector mBoneWeights; // Vectors of bone weights - bool mBuffered; // Bool value that indicates whether the attributes have been buffered. + bool mBuffered = false; // Bool value that indicates whether the attributes have been buffered. public: CVertexBuffer(); - CVertexBuffer(FVertexDescription Desc); + explicit CVertexBuffer(FVertexDescription Desc); ~CVertexBuffer(); uint16 AddVertex(const CVertex& rkVtx); uint16 AddIfUnique(const CVertex& rkVtx, uint16 Start); @@ -32,11 +32,11 @@ public: void Buffer(); void Bind(); void Unbind(); - bool IsBuffered(); - FVertexDescription VertexDesc(); + bool IsBuffered() const; + FVertexDescription VertexDesc() const; void SetVertexDesc(FVertexDescription Desc); void SetSkin(CSkin *pSkin); - uint32 Size(); + uint32 Size() const; GLuint CreateVAO(); }; diff --git a/src/Core/Render/CRenderBucket.h b/src/Core/Render/CRenderBucket.h index fed30fa5..b201e062 100644 --- a/src/Core/Render/CRenderBucket.h +++ b/src/Core/Render/CRenderBucket.h @@ -12,19 +12,16 @@ class CRenderBucket { - bool mEnableDepthSortDebugVisualization; + bool mEnableDepthSortDebugVisualization = false; class CSubBucket { std::vector mRenderables; - uint32 mEstSize; - uint32 mSize; + uint32 mEstSize = 0; + uint32 mSize = 0; public: - CSubBucket() - : mEstSize(0) - , mSize(0) - {} + CSubBucket() = default; void Add(const SRenderablePtr &rkPtr); void Sort(const CCamera *pkCamera, bool DebugVisualization); @@ -36,9 +33,7 @@ class CRenderBucket CSubBucket mTransparentSubBucket; public: - CRenderBucket() - : mEnableDepthSortDebugVisualization(false) - {} + CRenderBucket() = default; void Add(const SRenderablePtr& rkPtr, bool Transparent); void Clear(); diff --git a/src/Core/Render/IRenderable.h b/src/Core/Render/IRenderable.h index 21bad974..2fcac616 100644 --- a/src/Core/Render/IRenderable.h +++ b/src/Core/Render/IRenderable.h @@ -11,8 +11,8 @@ class CRenderer; class IRenderable { public: - IRenderable() {} - virtual ~IRenderable() {} + IRenderable() = default; + virtual ~IRenderable() = default; virtual void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) = 0; virtual void Draw(FRenderOptions /*Options*/, int /*ComponentIndex*/, ERenderCommand /*Command*/, const SViewInfo& /*rkViewInfo*/) {} virtual void DrawSelection() {} diff --git a/src/Core/Render/SViewInfo.h b/src/Core/Render/SViewInfo.h index 4ea38871..4154f884 100644 --- a/src/Core/Render/SViewInfo.h +++ b/src/Core/Render/SViewInfo.h @@ -9,28 +9,19 @@ struct SCollisionRenderSettings { - uint64 HighlightMask; - uint64 HideMask; - int BoundingHierarchyRenderDepth; + uint64 HighlightMask = 0; + uint64 HideMask = 0; + int BoundingHierarchyRenderDepth = 0; CCollisionMaterial HideMaterial; - bool DrawWireframe; - bool DrawBackfaces; - bool DrawAreaCollisionBounds; - bool DrawBoundingHierarchy; - bool TintWithSurfaceColor; - bool TintUnwalkableTris; + bool DrawWireframe = true; + bool DrawBackfaces = false; + bool DrawAreaCollisionBounds = true; + bool DrawBoundingHierarchy = false; + bool TintWithSurfaceColor = true; + bool TintUnwalkableTris = true; - SCollisionRenderSettings() - : HighlightMask(0) - , HideMask(0) - , BoundingHierarchyRenderDepth(0) - , DrawWireframe(true) - , DrawBackfaces(false) - , DrawAreaCollisionBounds(true) - , DrawBoundingHierarchy(false) - , TintWithSurfaceColor(true) - , TintUnwalkableTris(true) {} + SCollisionRenderSettings() = default; }; struct SViewInfo diff --git a/src/Core/Resource/Animation/CSkeleton.h b/src/Core/Resource/Animation/CSkeleton.h index dd6d4fd4..9eca4f18 100644 --- a/src/Core/Resource/Animation/CSkeleton.h +++ b/src/Core/Resource/Animation/CSkeleton.h @@ -14,12 +14,11 @@ class CBone; struct SBoneTransformInfo { - CVector3f Position; - CQuaternion Rotation; - CVector3f Scale; + CVector3f Position{CVector3f::skZero}; + CQuaternion Rotation{CQuaternion::skIdentity}; + CVector3f Scale{CVector3f::skOne}; - SBoneTransformInfo() - : Position(CVector3f::skZero), Rotation(CQuaternion::skIdentity), Scale(CVector3f::skOne) {} + SBoneTransformInfo() = default; }; class CSkeleton : public CResource @@ -33,8 +32,8 @@ class CSkeleton : public CResource static const float skSphereRadius; public: - CSkeleton(CResourceEntry *pEntry = 0); - ~CSkeleton(); + explicit CSkeleton(CResourceEntry *pEntry = nullptr); + ~CSkeleton() override; void UpdateTransform(CBoneTransformData& rData, CAnimation *pAnim, float Time, bool AnchorRoot); CBone* BoneByID(uint32 BoneID) const; CBone* BoneByName(const TString& rkBoneName) const; @@ -43,8 +42,8 @@ public: void Draw(FRenderOptions Options, const CBoneTransformData *pkData); std::pair RayIntersect(const CRay& rkRay, const CBoneTransformData& rkData); - inline uint32 NumBones() const { return mBones.size(); } - inline CBone* RootBone() const { return mpRootBone; } + uint32 NumBones() const { return mBones.size(); } + CBone* RootBone() const { return mpRootBone; } }; class CBone diff --git a/src/Core/Resource/Animation/CSkin.h b/src/Core/Resource/Animation/CSkin.h index 4679e0ad..9d90cf43 100644 --- a/src/Core/Resource/Animation/CSkin.h +++ b/src/Core/Resource/Animation/CSkin.h @@ -23,7 +23,7 @@ class CSkin : public CResource std::vector mVertGroups; public: - CSkin(CResourceEntry *pEntry = 0) : CResource(pEntry) {} + explicit CSkin(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {} const SVertexWeights& WeightsForVertex(uint32 VertIdx) { diff --git a/src/Core/Resource/Animation/CSourceAnimData.h b/src/Core/Resource/Animation/CSourceAnimData.h index 08878801..dd0a052f 100644 --- a/src/Core/Resource/Animation/CSourceAnimData.h +++ b/src/Core/Resource/Animation/CSourceAnimData.h @@ -27,7 +27,7 @@ class CSourceAnimData : public CResource IMetaTransition *mpDefaultTransition; public: - CSourceAnimData(CResourceEntry *pEntry = 0) + explicit CSourceAnimData(CResourceEntry *pEntry = nullptr) : CResource(pEntry) , mpDefaultTransition(nullptr) {} @@ -43,7 +43,7 @@ public: delete mpDefaultTransition; } - CDependencyTree* BuildDependencyTree() const + CDependencyTree* BuildDependencyTree() const override { // SAND normally has dependencies from meta-transitions and events // However, all of these can be character-specific. To simplify things, all SAND diff --git a/src/Core/Resource/Animation/IMetaAnimation.h b/src/Core/Resource/Animation/IMetaAnimation.h index d053bea7..9780b98c 100644 --- a/src/Core/Resource/Animation/IMetaAnimation.h +++ b/src/Core/Resource/Animation/IMetaAnimation.h @@ -26,11 +26,11 @@ extern CMetaAnimFactory gMetaAnimFactory; class CAnimPrimitive { TResPtr mpAnim; - uint32 mID; + uint32 mID = 0; TString mName; public: - CAnimPrimitive() : mID(0) {} + CAnimPrimitive() = default; CAnimPrimitive(const CAssetID& rkAnimAssetID, uint32 CharAnimID, const TString& rkAnimName) : mID(CharAnimID), mName(rkAnimName) @@ -45,8 +45,9 @@ public: mName = rInput.ReadString(); } - inline bool operator==(const CAnimPrimitive& rkRight) const { return mID == rkRight.mID; } - inline bool operator< (const CAnimPrimitive& rkRight) const { return mID < rkRight.mID; } + bool operator==(const CAnimPrimitive& other) const { return mID == other.mID; } + bool operator!=(const CAnimPrimitive& other) const { return !operator==(other); } + bool operator< (const CAnimPrimitive& other) const { return mID < other.mID; } // Accessors CAnimation* Animation() const { return mpAnim; } @@ -58,8 +59,8 @@ public: class IMetaAnimation { public: - IMetaAnimation() {} - virtual ~IMetaAnimation() {} + IMetaAnimation() = default; + virtual ~IMetaAnimation() = default; virtual EMetaAnimType Type() const = 0; virtual void GetUniquePrimitives(std::set& rPrimSet) const = 0; @@ -78,13 +79,13 @@ protected: public: CMetaAnimPlay(const CAnimPrimitive& rkPrimitive, float UnkA, uint32 UnkB); CMetaAnimPlay(IInputStream& rInput, EGame Game); - virtual EMetaAnimType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaAnimType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; // Accessors - inline CAnimPrimitive Primitive() const { return mPrimitive; } - inline float UnknownA() const { return mUnknownA; } - inline uint32 UnknownB() const { return mUnknownB; } + CAnimPrimitive Primitive() const { return mPrimitive; } + float UnknownA() const { return mUnknownA; } + uint32 UnknownB() const { return mUnknownB; } }; // CMetaAnimBlend - blend between two animations @@ -100,14 +101,14 @@ protected: public: CMetaAnimBlend(EMetaAnimType Type, IInputStream& rInput, EGame Game); ~CMetaAnimBlend(); - virtual EMetaAnimType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaAnimType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; // Accessors - inline IMetaAnimation* BlendAnimationA() const { return mpMetaAnimA; } - inline IMetaAnimation* BlendAnimationB() const { return mpMetaAnimB; } - inline float UnknownA() const { return mUnknownA; } - inline bool UnknownB() const { return mUnknownB; } + IMetaAnimation* BlendAnimationA() const { return mpMetaAnimA; } + IMetaAnimation* BlendAnimationB() const { return mpMetaAnimB; } + float UnknownA() const { return mUnknownA; } + bool UnknownB() const { return mUnknownB; } }; // SAnimProbabilityPair - structure used by CMetaAnimationRandom to associate an animation with a probability value @@ -126,8 +127,8 @@ protected: public: CMetaAnimRandom(IInputStream& rInput, EGame Game); ~CMetaAnimRandom(); - virtual EMetaAnimType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaAnimType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; }; // CMetaAnim - play a series of animations in sequence @@ -139,8 +140,8 @@ protected: public: CMetaAnimSequence(IInputStream& rInput, EGame Game); ~CMetaAnimSequence(); - virtual EMetaAnimType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaAnimType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; }; #endif // IMETAANIMATION diff --git a/src/Core/Resource/Animation/IMetaTransition.h b/src/Core/Resource/Animation/IMetaTransition.h index 1639c074..8d25d390 100644 --- a/src/Core/Resource/Animation/IMetaTransition.h +++ b/src/Core/Resource/Animation/IMetaTransition.h @@ -27,8 +27,8 @@ extern CMetaTransFactory gMetaTransFactory; class IMetaTransition { public: - IMetaTransition() {} - virtual ~IMetaTransition() {} + IMetaTransition() = default; + virtual ~IMetaTransition() = default; virtual EMetaTransType Type() const = 0; virtual void GetUniquePrimitives(std::set& rPrimSet) const = 0; }; @@ -41,8 +41,8 @@ class CMetaTransMetaAnim : public IMetaTransition public: CMetaTransMetaAnim(IInputStream& rInput, EGame Game); ~CMetaTransMetaAnim(); - virtual EMetaTransType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaTransType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; }; // CMetaTransTrans @@ -57,8 +57,8 @@ class CMetaTransTrans : public IMetaTransition public: CMetaTransTrans(EMetaTransType Type, IInputStream& rInput, EGame Game); - virtual EMetaTransType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaTransType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; }; // CMetaTransSnap @@ -66,8 +66,8 @@ class CMetaTransSnap : public IMetaTransition { public: CMetaTransSnap(IInputStream& rInput, EGame Game); - virtual EMetaTransType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaTransType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; }; // CMetaTransType4 @@ -75,8 +75,8 @@ class CMetaTransType4 : public IMetaTransition { public: CMetaTransType4(IInputStream& rInput, EGame Game); - virtual EMetaTransType Type() const; - virtual void GetUniquePrimitives(std::set& rPrimSet) const; + EMetaTransType Type() const override; + void GetUniquePrimitives(std::set& rPrimSet) const override; }; #endif // IMETATRANSITION_H diff --git a/src/Core/Resource/Area/CGameArea.h b/src/Core/Resource/Area/CGameArea.h index ff930b91..a0ff5c16 100644 --- a/src/Core/Resource/Area/CGameArea.h +++ b/src/Core/Resource/Area/CGameArea.h @@ -65,9 +65,9 @@ class CGameArea : public CResource std::vector< std::vector > mExtraLayerDeps; public: - CGameArea(CResourceEntry *pEntry = 0); + CGameArea(CResourceEntry *pEntry = nullptr); ~CGameArea(); - CDependencyTree* BuildDependencyTree() const; + CDependencyTree* BuildDependencyTree() const override; void AddWorldModel(CModel *pModel); void MergeTerrain(); @@ -85,26 +85,26 @@ public: void DeleteInstance(CScriptObject *pInstance); void ClearExtraDependencies(); - // Inline Accessors - inline uint32 WorldIndex() const { return mWorldIndex; } - inline CTransform4f Transform() const { return mTransform; } - inline CMaterialSet* Materials() const { return mpMaterialSet; } - inline uint32 NumWorldModels() const { return mWorldModels.size(); } - inline uint32 NumStaticModels() const { return mStaticWorldModels.size(); } - inline CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; } - inline CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; } - inline CCollisionMeshGroup* Collision() const { return mpCollision.get(); } - inline uint32 NumScriptLayers() const { return mScriptLayers.size(); } - inline CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; } - inline uint32 NumLightLayers() const { return mLightLayers.size(); } - inline uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); } - inline CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; } - inline CAssetID PathID() const { return mPathID; } - inline CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; } - inline CAssetID PortalAreaID() const { return mPortalAreaID; } - inline CAABox AABox() const { return mAABox; } + // Accessors + uint32 WorldIndex() const { return mWorldIndex; } + CTransform4f Transform() const { return mTransform; } + CMaterialSet* Materials() const { return mpMaterialSet; } + uint32 NumWorldModels() const { return mWorldModels.size(); } + uint32 NumStaticModels() const { return mStaticWorldModels.size(); } + CModel* TerrainModel(uint32 iMdl) const { return mWorldModels[iMdl]; } + CStaticModel* StaticModel(uint32 iMdl) const { return mStaticWorldModels[iMdl]; } + CCollisionMeshGroup* Collision() const { return mpCollision.get(); } + uint32 NumScriptLayers() const { return mScriptLayers.size(); } + CScriptLayer* ScriptLayer(uint32 Index) const { return mScriptLayers[Index]; } + uint32 NumLightLayers() const { return mLightLayers.size(); } + uint32 NumLights(uint32 LayerIndex) const { return (LayerIndex < mLightLayers.size() ? mLightLayers[LayerIndex].size() : 0); } + CLight* Light(uint32 LayerIndex, uint32 LightIndex) { return &mLightLayers[LayerIndex][LightIndex]; } + CAssetID PathID() const { return mPathID; } + CPoiToWorld* PoiToWorldMap() const { return mpPoiToWorldMap; } + CAssetID PortalAreaID() const { return mPortalAreaID; } + CAABox AABox() const { return mAABox; } - inline void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; } + void SetWorldIndex(uint32 NewWorldIndex) { mWorldIndex = NewWorldIndex; } }; #endif // CGAMEAREA_H diff --git a/src/Core/Resource/CFont.h b/src/Core/Resource/CFont.h index 5042755a..7a23d6e3 100644 --- a/src/Core/Resource/CFont.h +++ b/src/Core/Resource/CFont.h @@ -59,17 +59,17 @@ class CFont : public CResource public: - CFont(CResourceEntry *pEntry = 0); + CFont(CResourceEntry *pEntry = nullptr); ~CFont(); - CDependencyTree* BuildDependencyTree() const; + CDependencyTree* BuildDependencyTree() const override; CVector2f RenderString(const TString& rkString, CRenderer *pRenderer, float AspectRatio, CVector2f Position = CVector2f(0,0), CColor FillColor = CColor::skWhite, CColor StrokeColor = CColor::skBlack, uint32 FontSize = CFONT_DEFAULT_SIZE); // Accessors - inline TString FontName() const { return mFontName; } - inline CTexture* Texture() const { return mpFontTexture; } + TString FontName() const { return mFontName; } + CTexture* Texture() const { return mpFontTexture; } private: static void InitBuffers(); static void ShutdownBuffers(); diff --git a/src/Core/Resource/CLight.h b/src/Core/Resource/CLight.h index 06033d8c..5db52414 100644 --- a/src/Core/Resource/CLight.h +++ b/src/Core/Resource/CLight.h @@ -43,17 +43,17 @@ private: public: // Accessors - inline ELightType Type() const { return mType; } - inline uint32 LayerIndex() const { return mLayerIndex; } - inline CVector3f Position() const { return mPosition; } - inline CVector3f Direction() const { return mDirection; } - inline CColor Color() const { return mColor; } - inline CVector3f DistAttenuation() const { return mDistAttenCoefficients; } - inline CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; } + ELightType Type() const { return mType; } + uint32 LayerIndex() const { return mLayerIndex; } + CVector3f Position() const { return mPosition; } + CVector3f Direction() const { return mDirection; } + CColor Color() const { return mColor; } + CVector3f DistAttenuation() const { return mDistAttenCoefficients; } + CVector3f AngleAttenuation() const { return mAngleAttenCoefficients; } - inline void SetLayer(uint32 Index) { mLayerIndex = Index; } - inline void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; } - inline void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; } + void SetLayer(uint32 Index) { mLayerIndex = Index; } + void SetPosition(const CVector3f& rkPosition) { mPosition = rkPosition; } + void SetDirection(const CVector3f& rkDirection) { mDirection = rkDirection; } float GetRadius() const; float GetIntensity() const; diff --git a/src/Core/Resource/CMapArea.h b/src/Core/Resource/CMapArea.h index d2f4216b..60808d29 100644 --- a/src/Core/Resource/CMapArea.h +++ b/src/Core/Resource/CMapArea.h @@ -10,13 +10,13 @@ class CMapArea : public CResource CAssetID mNameString; public: - CMapArea(CResourceEntry *pEntry = 0) + CMapArea(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {} - CDependencyTree* BuildDependencyTree() const + CDependencyTree* BuildDependencyTree() const override { - CDependencyTree *pTree = new CDependencyTree(); + auto *pTree = new CDependencyTree(); pTree->AddDependency(mNameString); return pTree; } diff --git a/src/Core/Resource/CMaterial.h b/src/Core/Resource/CMaterial.h index 1788ba7c..a30161df 100644 --- a/src/Core/Resource/CMaterial.h +++ b/src/Core/Resource/CMaterial.h @@ -126,34 +126,34 @@ public: void SetNumPasses(uint32 NumPasses); // Accessors - inline TString Name() const { return mName; } - inline EGame Version() const { return mVersion; } - inline FMaterialOptions Options() const { return mOptions; } - inline FVertexDescription VtxDesc() const { return mVtxDesc; } - inline GLenum BlendSrcFac() const { return mBlendSrcFac; } - inline GLenum BlendDstFac() const { return mBlendDstFac; } - inline CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; } - inline CColor TevColor(ETevOutput Out) const { return mTevColors[int(Out)]; } - inline CTexture* IndTexture() const { return mpIndirectTexture; } - inline bool IsLightingEnabled() const { return mLightingEnabled; } - inline uint32 EchoesUnknownA() const { return mEchoesUnknownA; } - inline uint32 EchoesUnknownB() const { return mEchoesUnknownB; } - inline uint32 PassCount() const { return mPasses.size(); } - inline CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex].get(); } - inline CMaterial* GetNextDrawPass() const { return mpNextDrawPassMaterial.get(); } - inline CMaterial* GetBloomVersion() const { return mpBloomMaterial.get(); } + TString Name() const { return mName; } + EGame Version() const { return mVersion; } + FMaterialOptions Options() const { return mOptions; } + FVertexDescription VtxDesc() const { return mVtxDesc; } + GLenum BlendSrcFac() const { return mBlendSrcFac; } + GLenum BlendDstFac() const { return mBlendDstFac; } + CColor Konst(uint32 KIndex) const { return mKonstColors[KIndex]; } + CColor TevColor(ETevOutput Out) const { return mTevColors[int(Out)]; } + CTexture* IndTexture() const { return mpIndirectTexture; } + bool IsLightingEnabled() const { return mLightingEnabled; } + uint32 EchoesUnknownA() const { return mEchoesUnknownA; } + uint32 EchoesUnknownB() const { return mEchoesUnknownB; } + uint32 PassCount() const { return mPasses.size(); } + CMaterialPass* Pass(uint32 PassIndex) const { return mPasses[PassIndex].get(); } + CMaterial* GetNextDrawPass() const { return mpNextDrawPassMaterial.get(); } + CMaterial* GetBloomVersion() const { return mpBloomMaterial.get(); } - inline void SetName(const TString& rkName) { mName = rkName; } - inline void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); } - inline void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); } - inline void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; } - inline void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); } - inline void SetTevColor(const CColor& Color, ETevOutput Out) { mTevColors[int(Out)] = Color; } - inline void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; } - inline void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); } + void SetName(const TString& rkName) { mName = rkName; } + void SetOptions(FMaterialOptions Options) { mOptions = Options; Update(); } + void SetVertexDescription(FVertexDescription Desc) { mVtxDesc = Desc; Update(); } + void SetBlendMode(GLenum SrcFac, GLenum DstFac) { mBlendSrcFac = SrcFac; mBlendDstFac = DstFac; mRecalcHash = true; } + void SetKonst(const CColor& Konst, uint32 KIndex) { mKonstColors[KIndex] = Konst; Update(); } + void SetTevColor(const CColor& Color, ETevOutput Out) { mTevColors[int(Out)] = Color; } + void SetIndTexture(CTexture *pTex) { mpIndirectTexture = pTex; } + void SetLightingEnabled(bool Enabled) { mLightingEnabled = Enabled; Update(); } // Static - inline static void KillCachedMaterial() { sCurrentMaterial = 0; } + static void KillCachedMaterial() { sCurrentMaterial = 0; } }; #endif // MATERIAL_H diff --git a/src/Core/Resource/CMaterialPass.h b/src/Core/Resource/CMaterialPass.h index 5dfc5f38..4bc6b247 100644 --- a/src/Core/Resource/CMaterialPass.h +++ b/src/Core/Resource/CMaterialPass.h @@ -72,23 +72,23 @@ public: void SetEnabled(bool Enabled); // Getters - inline CFourCC Type() const { return mPassType; } - inline TString NamedType() const { return PassTypeName(mPassType); } - inline ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; } - inline ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; } - inline ETevOutput ColorOutput() const { return mColorOutput; } - inline ETevOutput AlphaOutput() const { return mAlphaOutput; } - inline ETevKSel KColorSel() const { return mKColorSel; } - inline ETevKSel KAlphaSel() const { return mKAlphaSel; } - inline ETevRasSel RasSel() const { return mRasSel; } - inline float TevColorScale() const { return mTevColorScale; } - inline float TevAlphaScale() const { return mTevAlphaScale; } - inline uint32 TexCoordSource() const { return mTexCoordSource; } - inline CTexture* Texture() const { return mpTexture; } - inline EUVAnimMode AnimMode() const { return mAnimMode; } - inline float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; } - inline char TexSwapComp(uint32 Comp) const { return mTexSwapComps[Comp]; } - inline bool IsEnabled() const { return mEnabled; } + CFourCC Type() const { return mPassType; } + TString NamedType() const { return PassTypeName(mPassType); } + ETevColorInput ColorInput(uint32 Input) const { return mColorInputs[Input]; } + ETevAlphaInput AlphaInput(uint32 Input) const { return mAlphaInputs[Input]; } + ETevOutput ColorOutput() const { return mColorOutput; } + ETevOutput AlphaOutput() const { return mAlphaOutput; } + ETevKSel KColorSel() const { return mKColorSel; } + ETevKSel KAlphaSel() const { return mKAlphaSel; } + ETevRasSel RasSel() const { return mRasSel; } + float TevColorScale() const { return mTevColorScale; } + float TevAlphaScale() const { return mTevAlphaScale; } + uint32 TexCoordSource() const { return mTexCoordSource; } + CTexture* Texture() const { return mpTexture; } + EUVAnimMode AnimMode() const { return mAnimMode; } + float AnimParam(uint32 ParamIndex) const { return mAnimParams[ParamIndex]; } + char TexSwapComp(uint32 Comp) const { return mTexSwapComps[Comp]; } + bool IsEnabled() const { return mEnabled; } // Static static TString PassTypeName(CFourCC Type); diff --git a/src/Core/Resource/CMaterialSet.h b/src/Core/Resource/CMaterialSet.h index f8964e05..fb7fe7b8 100644 --- a/src/Core/Resource/CMaterialSet.h +++ b/src/Core/Resource/CMaterialSet.h @@ -14,9 +14,8 @@ class CMaterialSet std::vector> mMaterials; public: - CMaterialSet() {} - - ~CMaterialSet() {} + CMaterialSet() = default; + ~CMaterialSet() = default; CMaterialSet* Clone() { @@ -29,7 +28,7 @@ public: return pOut; } - uint32 NumMaterials() + uint32 NumMaterials() const { return mMaterials.size(); } diff --git a/src/Core/Resource/CPoiToWorld.h b/src/Core/Resource/CPoiToWorld.h index 493dacef..28b1784e 100644 --- a/src/Core/Resource/CPoiToWorld.h +++ b/src/Core/Resource/CPoiToWorld.h @@ -22,25 +22,25 @@ private: std::map mPoiLookupMap; public: - CPoiToWorld(CResourceEntry *pEntry = 0); - ~CPoiToWorld(); + explicit CPoiToWorld(CResourceEntry *pEntry = nullptr); + ~CPoiToWorld() override; void AddPoi(uint32 PoiID); void AddPoiMeshMap(uint32 PoiID, uint32 ModelID); void RemovePoi(uint32 PoiID); void RemovePoiMeshMap(uint32 PoiID, uint32 ModelID); - inline uint32 NumMappedPOIs() const + uint32 NumMappedPOIs() const { return mMaps.size(); } - inline const SPoiMap* MapByIndex(uint32 Index) const + const SPoiMap* MapByIndex(uint32 Index) const { return mMaps[Index]; } - inline const SPoiMap* MapByID(uint32 InstanceID) const + const SPoiMap* MapByID(uint32 InstanceID) const { auto it = mPoiLookupMap.find(InstanceID); diff --git a/src/Core/Resource/CResTypeFilter.h b/src/Core/Resource/CResTypeFilter.h index 0cf4db36..5e220546 100644 --- a/src/Core/Resource/CResTypeFilter.h +++ b/src/Core/Resource/CResTypeFilter.h @@ -7,11 +7,11 @@ class CResTypeFilter { - EGame mGame; + EGame mGame = EGame::Invalid; std::set mAcceptedTypes; public: - CResTypeFilter() : mGame(EGame::Invalid) { } + CResTypeFilter() = default; CResTypeFilter(EGame Game, const TString& rkTypeList) { FromString(Game, rkTypeList); } void SetAcceptedTypes(EGame Game, const TStringList& rkTypes) @@ -53,22 +53,22 @@ public: rArc << SerialParameter("AcceptedTypes", mAcceptedTypes, SH_Proxy); } - inline bool Accepts(EResourceType Type) const + bool Accepts(EResourceType Type) const { return mAcceptedTypes.find(Type) != mAcceptedTypes.end(); } - inline bool Accepts(CResTypeInfo *pType) const + bool Accepts(CResTypeInfo *pType) const { return pType && Accepts(pType->Type()); } - inline bool Accepts(CResourceEntry *pEntry) const + bool Accepts(CResourceEntry *pEntry) const { return pEntry && Accepts(pEntry->ResourceType()); } - inline bool Accepts(const CResTypeFilter& rkFilter) const + bool Accepts(const CResTypeFilter& rkFilter) const { for (auto Iter = mAcceptedTypes.begin(); Iter != mAcceptedTypes.end(); Iter++) { @@ -79,12 +79,12 @@ public: return false; } - inline bool operator==(const CResTypeFilter& rkOther) const + bool operator==(const CResTypeFilter& rkOther) const { return mAcceptedTypes == rkOther.mAcceptedTypes; } - inline bool operator!=(const CResTypeFilter& rkOther) const + bool operator!=(const CResTypeFilter& rkOther) const { return !(*this == rkOther); } diff --git a/src/Core/Resource/CResTypeInfo.h b/src/Core/Resource/CResTypeInfo.h index 05dcf684..3583cdd4 100644 --- a/src/Core/Resource/CResTypeInfo.h +++ b/src/Core/Resource/CResTypeInfo.h @@ -38,11 +38,11 @@ public: CFourCC CookedExtension(EGame Game) const; // Accessors - inline EResourceType Type() const { return mType; } - inline TString TypeName() const { return mTypeName; } - inline bool CanBeSerialized() const { return mCanBeSerialized; } - inline bool CanHaveDependencies() const { return mCanHaveDependencies; } - inline bool CanBeCreated() const { return mCanBeCreated; } + EResourceType Type() const { return mType; } + TString TypeName() const { return mTypeName; } + bool CanBeSerialized() const { return mCanBeSerialized; } + bool CanHaveDependencies() const { return mCanHaveDependencies; } + bool CanBeCreated() const { return mCanBeCreated; } // Static static void GetAllTypesInGame(EGame Game, std::list& rOut); diff --git a/src/Core/Resource/CResource.h b/src/Core/Resource/CResource.h index 2d762819..3707a3ed 100644 --- a/src/Core/Resource/CResource.h +++ b/src/Core/Resource/CResource.h @@ -32,11 +32,11 @@ class CResource DECLARE_RESOURCE_TYPE(Resource) CResourceEntry *mpEntry; - int mRefCount; + int mRefCount = 0; public: - CResource(CResourceEntry *pEntry = 0) - : mpEntry(pEntry), mRefCount(0) + explicit CResource(CResourceEntry *pEntry = nullptr) + : mpEntry(pEntry) { } @@ -44,17 +44,17 @@ public: virtual CDependencyTree* BuildDependencyTree() const { return new CDependencyTree(); } virtual void Serialize(IArchive& /*rArc*/) {} virtual void InitializeNewResource() {} - - inline CResourceEntry* Entry() const { return mpEntry; } - inline CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); } - inline EResourceType Type() const { return mpEntry->TypeInfo()->Type(); } - inline TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; } - inline TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; } - inline CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; } - inline EGame Game() const { return mpEntry ? mpEntry->Game() : EGame::Invalid; } - inline bool IsReferenced() const { return mRefCount > 0; } - inline void Lock() { mRefCount++; } - inline void Release() { mRefCount--; } + + CResourceEntry* Entry() const { return mpEntry; } + CResTypeInfo* TypeInfo() const { return mpEntry->TypeInfo(); } + EResourceType Type() const { return mpEntry->TypeInfo()->Type(); } + TString Source() const { return mpEntry ? mpEntry->CookedAssetPath(true).GetFileName() : ""; } + TString FullSource() const { return mpEntry ? mpEntry->CookedAssetPath(true) : ""; } + CAssetID ID() const { return mpEntry ? mpEntry->ID() : CAssetID::skInvalidID64; } + EGame Game() const { return mpEntry ? mpEntry->Game() : EGame::Invalid; } + bool IsReferenced() const { return mRefCount > 0; } + void Lock() { mRefCount++; } + void Release() { mRefCount--; } }; #endif // CRESOURCE_H diff --git a/src/Core/Resource/CSavedStateID.h b/src/Core/Resource/CSavedStateID.h index 417a0ed9..5082e64f 100644 --- a/src/Core/Resource/CSavedStateID.h +++ b/src/Core/Resource/CSavedStateID.h @@ -21,13 +21,13 @@ public: m[1] = Part2; } - CSavedStateID(IInputStream& rInput) + explicit CSavedStateID(IInputStream& rInput) { m[0] = rInput.ReadLongLong(); m[1] = rInput.ReadLongLong(); } - TString ToString() + TString ToString() const { uint32 Part1 = (m[0] >> 32) & 0xFFFFFFFF; uint32 Part2 = (m[0] >> 16) & 0x0000FFFF; @@ -61,17 +61,17 @@ public: } // Operators - inline bool operator==(const CSavedStateID& rkOther) + bool operator==(const CSavedStateID& rkOther) const { return (m[0] == rkOther.m[0] && m[1] == rkOther.m[1]); } - inline bool operator!=(const CSavedStateID& rkOther) + bool operator!=(const CSavedStateID& rkOther) const { return !(*this == rkOther); } - inline bool operator<(const CSavedStateID& rkOther) + bool operator<(const CSavedStateID& rkOther) const { return (m[0] == rkOther.m[0] ? m[1] < rkOther.m[1] : m[0] < rkOther.m[0]); } diff --git a/src/Core/Resource/CStringList.h b/src/Core/Resource/CStringList.h index fd8ec541..6c3ae8b5 100644 --- a/src/Core/Resource/CStringList.h +++ b/src/Core/Resource/CStringList.h @@ -10,16 +10,16 @@ class CStringList : public CResource std::vector mStringList; public: - CStringList(CResourceEntry *pEntry = 0) + explicit CStringList(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {} - inline uint32 NumStrings() const + uint32 NumStrings() const { return mStringList.size(); } - inline TString StringByIndex(uint32 Index) const + TString StringByIndex(uint32 Index) const { ASSERT(Index >= 0 && Index < mStringList.size()); return mStringList[Index]; diff --git a/src/Core/Resource/CTexture.cpp b/src/Core/Resource/CTexture.cpp index 4dd956ee..ba545f0b 100644 --- a/src/Core/Resource/CTexture.cpp +++ b/src/Core/Resource/CTexture.cpp @@ -1,34 +1,16 @@ #include "CTexture.h" #include -CTexture::CTexture(CResourceEntry *pEntry /*= 0*/) +CTexture::CTexture(CResourceEntry *pEntry) : CResource(pEntry) - , mTexelFormat(ETexelFormat::RGBA8) - , mSourceTexelFormat(ETexelFormat::RGBA8) - , mWidth(0) - , mHeight(0) - , mNumMipMaps(0) - , mLinearSize(0) - , mEnableMultisampling(false) - , mBufferExists(false) - , mpImgDataBuffer(nullptr) - , mImgDataSize(0) - , mGLBufferExists(false) { } CTexture::CTexture(uint32 Width, uint32 Height) - : mTexelFormat(ETexelFormat::RGBA8) - , mSourceTexelFormat(ETexelFormat::RGBA8) - , mWidth((uint16) Width) - , mHeight((uint16) Height) + : mWidth(static_cast(Width)) + , mHeight(static_cast(Height)) , mNumMipMaps(1) , mLinearSize(Width * Height * 4) - , mEnableMultisampling(false) - , mBufferExists(false) - , mpImgDataBuffer(nullptr) - , mImgDataSize(0) - , mGLBufferExists(false) { } diff --git a/src/Core/Resource/CTexture.h b/src/Core/Resource/CTexture.h index cd0f47cc..c4220e3a 100644 --- a/src/Core/Resource/CTexture.h +++ b/src/Core/Resource/CTexture.h @@ -15,22 +15,23 @@ class CTexture : public CResource friend class CTextureDecoder; friend class CTextureEncoder; - ETexelFormat mTexelFormat; // Format of decoded image data - ETexelFormat mSourceTexelFormat; // Format of input TXTR file - uint16 mWidth, mHeight; // Image dimensions - uint32 mNumMipMaps; // The number of mipmaps this texture has - uint32 mLinearSize; // The size of the top level mipmap, in bytes + ETexelFormat mTexelFormat{ETexelFormat::RGBA8}; // Format of decoded image data + ETexelFormat mSourceTexelFormat{ETexelFormat::RGBA8}; // Format of input TXTR file + uint16 mWidth = 0; // Image width + uint16 mHeight = 0; // Image height + uint32 mNumMipMaps = 0; // The number of mipmaps this texture has + uint32 mLinearSize = 0; // The size of the top level mipmap, in bytes - bool mEnableMultisampling; // Whether multisample should be enabled (if this texture is a render target). - bool mBufferExists; // Indicates whether image data buffer has valid data - uint8 *mpImgDataBuffer; // Pointer to image data buffer - uint32 mImgDataSize; // Size of image data buffer + bool mEnableMultisampling = false; // Whether multisample should be enabled (if this texture is a render target). + bool mBufferExists = false; // Indicates whether image data buffer has valid data + uint8 *mpImgDataBuffer = nullptr; // Pointer to image data buffer + uint32 mImgDataSize = 0; // Size of image data buffer - bool mGLBufferExists; // Indicates whether GL buffer has valid data - GLuint mTextureID; // ID for texture GL buffer + bool mGLBufferExists = false; // Indicates whether GL buffer has valid data + GLuint mTextureID = 0; // ID for texture GL buffer public: - CTexture(CResourceEntry *pEntry = 0); + explicit CTexture(CResourceEntry *pEntry = nullptr); CTexture(uint32 Width, uint32 Height); ~CTexture(); @@ -48,7 +49,7 @@ public: uint32 NumMipMaps() const { return mNumMipMaps; } GLuint TextureID() const { return mTextureID; } - inline void SetMultisamplingEnabled(bool Enable) + void SetMultisamplingEnabled(bool Enable) { if (mEnableMultisampling != Enable) DeleteBuffers(); diff --git a/src/Core/Resource/CWorld.h b/src/Core/Resource/CWorld.h index 5ee1e666..840e4837 100644 --- a/src/Core/Resource/CWorld.h +++ b/src/Core/Resource/CWorld.h @@ -87,17 +87,17 @@ class CWorld : public CResource std::vector mAreas; public: - CWorld(CResourceEntry *pEntry = 0); + explicit CWorld(CResourceEntry *pEntry = nullptr); ~CWorld(); - CDependencyTree* BuildDependencyTree() const; + CDependencyTree* BuildDependencyTree() const override; void SetAreaLayerInfo(CGameArea *pArea); TString InGameName() const; TString AreaInGameName(uint32 AreaIndex) const; uint32 AreaIndex(CAssetID AreaID) const; // Serialization - virtual void Serialize(IArchive& rArc); + void Serialize(IArchive& rArc) override; friend void Serialize(IArchive& rArc, STimeAttackData& rTimeAttackData); friend void Serialize(IArchive& rArc, SMemoryRelay& rMemRelay); friend void Serialize(IArchive& rArc, SArea& rArea); @@ -107,23 +107,23 @@ public: friend void Serialize(IArchive& rArc, SAudioGrp& rAudioGrp); // Accessors - inline TString Name() const { return mName; } - inline CStringTable* NameString() const { return mpWorldName; } - inline CStringTable* DarkNameString() const { return mpDarkWorldName; } - inline CResource* SaveWorld() const { return mpSaveWorld; } - inline CModel* DefaultSkybox() const { return mpDefaultSkybox; } - inline CResource* MapWorld() const { return mpMapWorld; } + TString Name() const { return mName; } + CStringTable* NameString() const { return mpWorldName; } + CStringTable* DarkNameString() const { return mpDarkWorldName; } + CResource* SaveWorld() const { return mpSaveWorld; } + CModel* DefaultSkybox() const { return mpDefaultSkybox; } + CResource* MapWorld() const { return mpMapWorld; } - inline uint32 NumAreas() const { return mAreas.size(); } - inline CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; } - inline uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); } - inline uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; } - inline TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; } - inline CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; } - inline bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; } + uint32 NumAreas() const { return mAreas.size(); } + CAssetID AreaResourceID(uint32 AreaIndex) const { return mAreas[AreaIndex].AreaResID; } + uint32 AreaAttachedCount(uint32 AreaIndex) const { return mAreas[AreaIndex].AttachedAreaIDs.size(); } + uint32 AreaAttachedID(uint32 AreaIndex, uint32 AttachedIndex) const { return mAreas[AreaIndex].AttachedAreaIDs[AttachedIndex]; } + TString AreaInternalName(uint32 AreaIndex) const { return mAreas[AreaIndex].InternalName; } + CStringTable* AreaName(uint32 AreaIndex) const { return mAreas[AreaIndex].pAreaName; } + bool DoesAreaAllowPakDuplicates(uint32 AreaIndex) const { return mAreas[AreaIndex].AllowPakDuplicates; } - inline void SetName(const TString& rkName) { mName = rkName; } - inline void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; } + void SetName(const TString& rkName) { mName = rkName; } + void SetAreaAllowsPakDuplicates(uint32 AreaIndex, bool Allow) { mAreas[AreaIndex].AllowPakDuplicates = Allow; } }; #endif // CWORLD_H diff --git a/src/Core/Resource/Collision/CCollidableOBBTree.h b/src/Core/Resource/Collision/CCollidableOBBTree.h index 637b4721..6006c65f 100644 --- a/src/Core/Resource/Collision/CCollidableOBBTree.h +++ b/src/Core/Resource/Collision/CCollidableOBBTree.h @@ -11,12 +11,12 @@ class CCollidableOBBTree : public CCollisionMesh std::unique_ptr mpOBBTree; public: - virtual void BuildRenderData() override; + void BuildRenderData() override; void BuildOBBTree(); /** Accessors */ - inline SOBBTreeNode* GetOBBTree() const + SOBBTreeNode* GetOBBTree() const { return mpOBBTree.get(); } diff --git a/src/Core/Resource/Collision/CCollisionMaterial.h b/src/Core/Resource/Collision/CCollisionMaterial.h index e1ed6dd9..e06592aa 100644 --- a/src/Core/Resource/Collision/CCollisionMaterial.h +++ b/src/Core/Resource/Collision/CCollisionMaterial.h @@ -59,7 +59,7 @@ public: bool IsFloor() const; bool IsUnstandable(EGame Game) const; - inline uint64 RawFlags() const { return mRawFlags; } + uint64 RawFlags() const { return mRawFlags; } }; #endif // CCOLLISIONMATERIAL diff --git a/src/Core/Resource/Collision/CCollisionMesh.h b/src/Core/Resource/Collision/CCollisionMesh.h index e0f0b317..2e7659a0 100644 --- a/src/Core/Resource/Collision/CCollisionMesh.h +++ b/src/Core/Resource/Collision/CCollisionMesh.h @@ -21,22 +21,22 @@ public: virtual void BuildRenderData(); /** Accessors */ - inline CAABox Bounds() const + CAABox Bounds() const { return mAABox; } - inline const SCollisionIndexData& GetIndexData() const + const SCollisionIndexData& GetIndexData() const { return mIndexData; } - inline const CCollisionRenderData& GetRenderData() const + const CCollisionRenderData& GetRenderData() const { return mRenderData; } - inline CCollisionRenderData& GetRenderData() + CCollisionRenderData& GetRenderData() { return mRenderData; } diff --git a/src/Core/Resource/Collision/CCollisionMeshGroup.h b/src/Core/Resource/Collision/CCollisionMeshGroup.h index 1c920e18..0082b726 100644 --- a/src/Core/Resource/Collision/CCollisionMeshGroup.h +++ b/src/Core/Resource/Collision/CCollisionMeshGroup.h @@ -21,23 +21,23 @@ public: delete *it; } - inline uint32 NumMeshes() const { return mMeshes.size(); } - inline CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; } - inline void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); } + uint32 NumMeshes() const { return mMeshes.size(); } + CCollisionMesh* MeshByIndex(uint32 Index) const { return mMeshes[Index]; } + void AddMesh(CCollisionMesh *pMesh) { mMeshes.push_back(pMesh); } - inline void BuildRenderData() + void BuildRenderData() { for (auto It = mMeshes.begin(); It != mMeshes.end(); It++) (*It)->BuildRenderData(); } - inline void Draw() + void Draw() { for (auto it = mMeshes.begin(); it != mMeshes.end(); it++) (*it)->GetRenderData().Render(false); } - inline void DrawWireframe() + void DrawWireframe() { for (auto it = mMeshes.begin(); it != mMeshes.end(); it++) (*it)->GetRenderData().Render(true); diff --git a/src/Core/Resource/Collision/CCollisionRenderData.h b/src/Core/Resource/Collision/CCollisionRenderData.h index 05d822e8..b6493ea5 100644 --- a/src/Core/Resource/Collision/CCollisionRenderData.h +++ b/src/Core/Resource/Collision/CCollisionRenderData.h @@ -30,17 +30,13 @@ class CCollisionRenderData std::vector mBoundingDepthOffsets; /** Whether render data has been built */ - bool mBuilt; + bool mBuilt = false; /** Whether bounding hierarchy render data has been built */ - bool mBoundingHierarchyBuilt; + bool mBoundingHierarchyBuilt = false; public: - /** Default constructor */ - CCollisionRenderData() - : mBuilt(false) - , mBoundingHierarchyBuilt(false) - {} + CCollisionRenderData() = default; /** Build from collision data */ void BuildRenderData(const SCollisionIndexData& kIndexData); @@ -52,7 +48,7 @@ public: int MaxBoundingHierarchyDepth() const; /** Accessors */ - inline bool IsBuilt() const { return mBuilt; } + bool IsBuilt() const { return mBuilt; } }; #endif // CCOLLISIONRENDERDATA_H diff --git a/src/Core/Resource/Cooker/CPoiToWorldCooker.h b/src/Core/Resource/Cooker/CPoiToWorldCooker.h index feb86799..5f6780cf 100644 --- a/src/Core/Resource/Cooker/CPoiToWorldCooker.h +++ b/src/Core/Resource/Cooker/CPoiToWorldCooker.h @@ -6,7 +6,8 @@ class CPoiToWorldCooker { - CPoiToWorldCooker() {} + CPoiToWorldCooker() = default; + public: static bool CookEGMC(CPoiToWorld *pPoiToWorld, IOutputStream& rOut); }; diff --git a/src/Core/Resource/Cooker/CResourceCooker.h b/src/Core/Resource/Cooker/CResourceCooker.h index 8c5f0573..45bcd2b5 100644 --- a/src/Core/Resource/Cooker/CResourceCooker.h +++ b/src/Core/Resource/Cooker/CResourceCooker.h @@ -14,7 +14,7 @@ class CResourceCooker { - CResourceCooker() {} + CResourceCooker() = default; public: static bool CookResource(CResourceEntry *pEntry, IOutputStream& rOutput) diff --git a/src/Core/Resource/Cooker/CScanCooker.h b/src/Core/Resource/Cooker/CScanCooker.h index 3a473501..8743bd07 100644 --- a/src/Core/Resource/Cooker/CScanCooker.h +++ b/src/Core/Resource/Cooker/CScanCooker.h @@ -6,7 +6,7 @@ /** Cooker class for writing game-compatible SCAN assets */ class CScanCooker { - CScanCooker() {} + CScanCooker() = default; public: static bool CookSCAN(CScan* pScan, IOutputStream& SCAN); diff --git a/src/Core/Resource/Cooker/CScriptCooker.h b/src/Core/Resource/Cooker/CScriptCooker.h index 5db5206c..b53f2692 100644 --- a/src/Core/Resource/Cooker/CScriptCooker.h +++ b/src/Core/Resource/Cooker/CScriptCooker.h @@ -14,7 +14,7 @@ class CScriptCooker bool mWriteGeneratedSeparately; public: - CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true) + explicit CScriptCooker(EGame Game, bool WriteGeneratedObjectsSeparately = true) : mGame(Game) , mWriteGeneratedSeparately(WriteGeneratedObjectsSeparately && mGame >= EGame::EchoesDemo) {} diff --git a/src/Core/Resource/Cooker/CSectionMgrOut.h b/src/Core/Resource/Cooker/CSectionMgrOut.h index cc4aba7a..b01e502f 100644 --- a/src/Core/Resource/Cooker/CSectionMgrOut.h +++ b/src/Core/Resource/Cooker/CSectionMgrOut.h @@ -8,17 +8,13 @@ // Small class to manage file sections for CMDL/MREA output class CSectionMgrOut { - uint32 mSectionCount; - uint32 mCurSectionStart; - uint32 mCurSectionIndex; + uint32 mSectionCount = 0; + uint32 mCurSectionStart = 0; + uint32 mCurSectionIndex = 0; std::vector mSectionSizes; public: - CSectionMgrOut() - : mSectionCount(0) - , mCurSectionStart(0) - , mCurSectionIndex(0) - {} + CSectionMgrOut() = default; void SetSectionCount(uint32 Count) { diff --git a/src/Core/Resource/Cooker/CStringCooker.h b/src/Core/Resource/Cooker/CStringCooker.h index 170fa777..370e9d41 100644 --- a/src/Core/Resource/Cooker/CStringCooker.h +++ b/src/Core/Resource/Cooker/CStringCooker.h @@ -9,7 +9,7 @@ class CStringCooker { TResPtr mpStringTable; - CStringCooker(CStringTable* pStringTable) + explicit CStringCooker(CStringTable* pStringTable) : mpStringTable(pStringTable) {} public: diff --git a/src/Core/Resource/Cooker/CTextureEncoder.cpp b/src/Core/Resource/Cooker/CTextureEncoder.cpp index f9a21058..2031e798 100644 --- a/src/Core/Resource/Cooker/CTextureEncoder.cpp +++ b/src/Core/Resource/Cooker/CTextureEncoder.cpp @@ -1,10 +1,7 @@ #include "CTextureEncoder.h" #include -CTextureEncoder::CTextureEncoder() - : mpTexture(nullptr) -{ -} +CTextureEncoder::CTextureEncoder() = default; void CTextureEncoder::WriteTXTR(IOutputStream& rTXTR) { diff --git a/src/Core/Resource/Cooker/CTextureEncoder.h b/src/Core/Resource/Cooker/CTextureEncoder.h index eaba569a..fc06ebd2 100644 --- a/src/Core/Resource/Cooker/CTextureEncoder.h +++ b/src/Core/Resource/Cooker/CTextureEncoder.h @@ -8,9 +8,9 @@ // More advanced functions (including actual encoding!) coming later class CTextureEncoder { - TResPtr mpTexture; - ETexelFormat mSourceFormat; - ETexelFormat mOutputFormat; + TResPtr mpTexture{nullptr}; + ETexelFormat mSourceFormat{}; + ETexelFormat mOutputFormat{}; CTextureEncoder(); void WriteTXTR(IOutputStream& rTXTR); diff --git a/src/Core/Resource/Factory/CPoiToWorldLoader.h b/src/Core/Resource/Factory/CPoiToWorldLoader.h index 5ab49d00..b2b9b033 100644 --- a/src/Core/Resource/Factory/CPoiToWorldLoader.h +++ b/src/Core/Resource/Factory/CPoiToWorldLoader.h @@ -8,7 +8,7 @@ class CPoiToWorldLoader { TResPtr mpPoiToWorld; - CPoiToWorldLoader() {} + CPoiToWorldLoader() = default; public: static CPoiToWorld* LoadEGMC(IInputStream& rEGMC, CResourceEntry *pEntry); diff --git a/src/Core/Resource/Factory/CScanLoader.h b/src/Core/Resource/Factory/CScanLoader.h index 088e82ee..f396fee7 100644 --- a/src/Core/Resource/Factory/CScanLoader.h +++ b/src/Core/Resource/Factory/CScanLoader.h @@ -8,7 +8,7 @@ class CScanLoader { TResPtr mpScan; - CScanLoader() {} + CScanLoader() = default; CScan* LoadScanMP1(IInputStream& SCAN, CResourceEntry* pEntry); CScan* LoadScanMP2(IInputStream& SCAN, CResourceEntry* pEntry); diff --git a/src/Core/Resource/Factory/CSectionMgrIn.h b/src/Core/Resource/Factory/CSectionMgrIn.h index b71e84dd..27556e9a 100644 --- a/src/Core/Resource/Factory/CSectionMgrIn.h +++ b/src/Core/Resource/Factory/CSectionMgrIn.h @@ -10,9 +10,9 @@ class CSectionMgrIn { IInputStream *mpInputStream; std::vector mSectionSizes; - uint32 mCurSec; - uint32 mCurSecStart; - uint32 mSecsStart; + uint32 mCurSec = 0; + uint32 mCurSecStart = 0; + uint32 mSecsStart = 0; public: CSectionMgrIn(uint32 Count, IInputStream* pSrc) @@ -24,7 +24,7 @@ public: mSectionSizes[iSec] = pSrc->ReadLong(); } - inline void Init() + void Init() { // Initializes the block manager and marks the start of the first block mCurSec = 0; @@ -43,18 +43,18 @@ public: mCurSecStart = mpInputStream->Tell(); } - inline void ToNextSection() + void ToNextSection() { mCurSecStart += mSectionSizes[mCurSec]; mpInputStream->Seek(mCurSecStart, SEEK_SET); mCurSec++; } - inline uint32 NextOffset() { return mCurSecStart + mSectionSizes[mCurSec]; } - inline uint32 CurrentSection() { return mCurSec; } - inline uint32 CurrentSectionSize() { return mSectionSizes[mCurSec]; } - inline uint32 NumSections() { return mSectionSizes.size(); } - inline void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; } + uint32 NextOffset() const { return mCurSecStart + mSectionSizes[mCurSec]; } + uint32 CurrentSection() const { return mCurSec; } + uint32 CurrentSectionSize() const { return mSectionSizes[mCurSec]; } + uint32 NumSections() const { return mSectionSizes.size(); } + void SetInputStream(IInputStream *pIn) { mpInputStream = pIn; } }; #endif // CSECTIONMGRIN_H diff --git a/src/Core/Resource/Factory/CSkeletonLoader.h b/src/Core/Resource/Factory/CSkeletonLoader.h index 5e794f70..9f59d180 100644 --- a/src/Core/Resource/Factory/CSkeletonLoader.h +++ b/src/Core/Resource/Factory/CSkeletonLoader.h @@ -8,9 +8,9 @@ class CSkeletonLoader { TResPtr mpSkeleton; - EGame mVersion; + EGame mVersion{}; - CSkeletonLoader() {} + CSkeletonLoader() = default; void SetLocalBoneCoords(CBone *pBone); void CalculateBoneInverseBindMatrices(); diff --git a/src/Core/Resource/Factory/CSkinLoader.h b/src/Core/Resource/Factory/CSkinLoader.h index 92e75c15..c13d12f0 100644 --- a/src/Core/Resource/Factory/CSkinLoader.h +++ b/src/Core/Resource/Factory/CSkinLoader.h @@ -6,7 +6,8 @@ class CSkinLoader { - CSkinLoader() {} + CSkinLoader() = default; + public: static CSkin* LoadCSKR(IInputStream& rCSKR, CResourceEntry *pEntry); }; diff --git a/src/Core/Resource/Factory/CStringLoader.h b/src/Core/Resource/Factory/CStringLoader.h index c441479c..0b309a60 100644 --- a/src/Core/Resource/Factory/CStringLoader.h +++ b/src/Core/Resource/Factory/CStringLoader.h @@ -8,10 +8,10 @@ class CStringLoader { - CStringTable *mpStringTable; - EGame mVersion; + CStringTable *mpStringTable = nullptr; + EGame mVersion{}; - CStringLoader() {} + CStringLoader() = default; void LoadPrimeDemoSTRG(IInputStream& STRG); void LoadPrimeSTRG(IInputStream& STRG); void LoadCorruptionSTRG(IInputStream& STRG); diff --git a/src/Core/Resource/Factory/CUnsupportedFormatLoader.h b/src/Core/Resource/Factory/CUnsupportedFormatLoader.h index 8b779896..47eb0979 100644 --- a/src/Core/Resource/Factory/CUnsupportedFormatLoader.h +++ b/src/Core/Resource/Factory/CUnsupportedFormatLoader.h @@ -9,8 +9,8 @@ // This is needed so we have access to the full dependency list of all resource types. class CUnsupportedFormatLoader { - CDependencyGroup *mpGroup; - CUnsupportedFormatLoader() {} + CDependencyGroup *mpGroup = nullptr; + CUnsupportedFormatLoader() = default; static void PerformCheating(IInputStream& rFile, EGame Game, std::list& rAssetList); diff --git a/src/Core/Resource/Factory/CUnsupportedParticleLoader.h b/src/Core/Resource/Factory/CUnsupportedParticleLoader.h index 99880d58..3a105a73 100644 --- a/src/Core/Resource/Factory/CUnsupportedParticleLoader.h +++ b/src/Core/Resource/Factory/CUnsupportedParticleLoader.h @@ -7,8 +7,8 @@ // Used for finding dependencies. Split from CUnsupportedFormatLoader for being too big. class CUnsupportedParticleLoader { - CDependencyGroup *mpGroup; - CUnsupportedParticleLoader() {} + CDependencyGroup *mpGroup = nullptr; + CUnsupportedParticleLoader() = default; // Format-Specific Parameter Loading bool ParseParticleParameter(IInputStream& rPART); diff --git a/src/Core/Resource/Factory/CWorldLoader.h b/src/Core/Resource/Factory/CWorldLoader.h index ad14c069..df3cf01e 100644 --- a/src/Core/Resource/Factory/CWorldLoader.h +++ b/src/Core/Resource/Factory/CWorldLoader.h @@ -9,7 +9,7 @@ class CWorldLoader { TResPtr mpWorld; - EGame mVersion; + EGame mVersion{}; CWorldLoader(); void LoadPrimeMLVL(IInputStream& rMLVL); diff --git a/src/Core/Resource/Model/CModel.h b/src/Core/Resource/Model/CModel.h index 13b02fe4..9d41a1e4 100644 --- a/src/Core/Resource/Model/CModel.h +++ b/src/Core/Resource/Model/CModel.h @@ -21,14 +21,14 @@ class CModel : public CBasicModel bool mHasOwnMaterials; public: - CModel(CResourceEntry *pEntry = 0); + explicit CModel(CResourceEntry *pEntry = nullptr); CModel(CMaterialSet *pSet, bool OwnsMatSet); ~CModel(); - CDependencyTree* BuildDependencyTree() const; + CDependencyTree* BuildDependencyTree() const override; void BufferGL(); void GenerateMaterialShaders(); - void ClearGLBuffer(); + void ClearGLBuffer() override; void Draw(FRenderOptions Options, uint32 MatSet); void DrawSurface(FRenderOptions Options, uint32 Surface, uint32 MatSet); void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite); @@ -43,7 +43,7 @@ public: bool IsSurfaceTransparent(uint32 Surface, uint32 MatSet); bool IsLightmapped() const; - inline bool IsSkinned() const { return (mpSkin != nullptr); } + bool IsSkinned() const { return (mpSkin != nullptr); } private: CIndexBuffer* InternalGetIBO(uint32 Surface, EPrimitiveType Primitive); diff --git a/src/Core/Resource/Model/CStaticModel.cpp b/src/Core/Resource/Model/CStaticModel.cpp index e5c4ccc1..1e6404aa 100644 --- a/src/Core/Resource/Model/CStaticModel.cpp +++ b/src/Core/Resource/Model/CStaticModel.cpp @@ -5,8 +5,6 @@ CStaticModel::CStaticModel() : CBasicModel(nullptr) - , mpMaterial(nullptr) - , mTransparent(false) { } @@ -17,9 +15,7 @@ CStaticModel::CStaticModel(CMaterial *pMat) { } -CStaticModel::~CStaticModel() -{ -} +CStaticModel::~CStaticModel() = default; void CStaticModel::AddSurface(SSurface *pSurface) { @@ -213,12 +209,12 @@ void CStaticModel::SetMaterial(CMaterial *pMat) mTransparent = pMat->Options().HasFlag(EMaterialOption::Transparent); } -bool CStaticModel::IsTransparent() +bool CStaticModel::IsTransparent() const { return mTransparent; } -bool CStaticModel::IsOccluder() +bool CStaticModel::IsOccluder() const { return mpMaterial->Options().HasFlag(EMaterialOption::Occluder); } diff --git a/src/Core/Resource/Model/CStaticModel.h b/src/Core/Resource/Model/CStaticModel.h index b58d24ca..6b2852de 100644 --- a/src/Core/Resource/Model/CStaticModel.h +++ b/src/Core/Resource/Model/CStaticModel.h @@ -10,14 +10,14 @@ * IBOs. This allows for a significantly reduced number of draw calls. */ class CStaticModel : public CBasicModel { - CMaterial *mpMaterial; + CMaterial *mpMaterial = nullptr; std::vector mIBOs; std::vector> mSurfaceEndOffsets; - bool mTransparent; + bool mTransparent = false; public: CStaticModel(); - CStaticModel(CMaterial *pMat); + explicit CStaticModel(CMaterial *pMat); ~CStaticModel(); void AddSurface(SSurface *pSurface); @@ -30,8 +30,8 @@ public: CMaterial* GetMaterial(); void SetMaterial(CMaterial *pMat); - bool IsTransparent(); - bool IsOccluder(); + bool IsTransparent() const; + bool IsOccluder() const; private: CIndexBuffer* InternalGetIBO(EPrimitiveType Primitive); diff --git a/src/Core/Resource/Model/CVertex.h b/src/Core/Resource/Model/CVertex.h index 416e901f..1bbfee52 100644 --- a/src/Core/Resource/Model/CVertex.h +++ b/src/Core/Resource/Model/CVertex.h @@ -6,8 +6,8 @@ #include #include -typedef std::array TBoneIndices; -typedef std::array TBoneWeights; +using TBoneIndices = std::array; +using TBoneWeights = std::array; class CVertex { @@ -24,12 +24,11 @@ public: CVertex() {} - CVertex(const CVector3f& rPos) + CVertex(const CVector3f& rPos) : Position{rPos} { - Position = rPos; } - bool operator==(const CVertex& rkOther) { + bool operator==(const CVertex& rkOther) const { return ((Position == rkOther.Position) && (Normal == rkOther.Normal) && (Color[0] == rkOther.Color[0]) && @@ -45,6 +44,11 @@ public: (BoneIndices == rkOther.BoneIndices) && (BoneWeights == rkOther.BoneWeights)); } + + bool operator!=(const CVertex& other) const + { + return !operator==(other); + } }; #endif // CVERTEX_H diff --git a/src/Core/Resource/Model/SSurface.h b/src/Core/Resource/Model/SSurface.h index 47c6d489..135f39a8 100644 --- a/src/Core/Resource/Model/SSurface.h +++ b/src/Core/Resource/Model/SSurface.h @@ -15,13 +15,13 @@ // Should prolly be a class struct SSurface { - uint32 VertexCount; - uint32 TriangleCount; + uint32 VertexCount = 0; + uint32 TriangleCount = 0; CAABox AABox; CVector3f CenterPoint; - uint32 MaterialID; + uint32 MaterialID = 0; CVector3f ReflectionDirection; - uint16 MeshID; + uint16 MeshID = 0; struct SPrimitive { @@ -30,11 +30,7 @@ struct SSurface }; std::vector Primitives; - SSurface() - { - VertexCount = 0; - TriangleCount = 0; - } + SSurface() = default; std::pair IntersectsRay(const CRay& rkRay, bool AllowBackfaces = false, float LineThreshold = 0.02f); }; diff --git a/src/Core/Resource/Scan/CScan.h b/src/Core/Resource/Scan/CScan.h index b8e19bc6..ae984c12 100644 --- a/src/Core/Resource/Scan/CScan.h +++ b/src/Core/Resource/Scan/CScan.h @@ -20,7 +20,7 @@ class CScan : public CResource std::vector mPropertyData; public: - CScan(CResourceEntry* pEntry = 0); + explicit CScan(CResourceEntry* pEntry = nullptr); CStructRef ScanData() const; /** Convenience property accessors */ @@ -28,7 +28,7 @@ public: CBoolRef IsCriticalPropertyRef() const; /** CResource interface */ - virtual CDependencyTree* BuildDependencyTree() const override; + CDependencyTree* BuildDependencyTree() const override; }; #endif // CSCAN_H diff --git a/src/Core/Resource/Script/CGameTemplate.h b/src/Core/Resource/Script/CGameTemplate.h index 867fcba1..53f577e7 100644 --- a/src/Core/Resource/Script/CGameTemplate.h +++ b/src/Core/Resource/Script/CGameTemplate.h @@ -19,12 +19,12 @@ struct SObjId CFourCC ID_4CC; }; - inline SObjId() {} - inline SObjId(uint32 InID) : ID(InID) {} - inline SObjId(CFourCC InID) : ID_4CC(InID) {} + SObjId() {} + SObjId(uint32 InID) : ID(InID) {} + SObjId(CFourCC InID) : ID_4CC(InID) {} - inline operator uint32() const { return ID; } - inline operator CFourCC() const { return ID_4CC; } + operator uint32() const { return ID; } + operator CFourCC() const { return ID_4CC; } void Serialize(IArchive& Arc) { @@ -61,8 +61,8 @@ struct TTemplatePath } }; -typedef TTemplatePath SScriptTemplatePath; -typedef TTemplatePath SPropertyTemplatePath; +using SScriptTemplatePath = TTemplatePath; +using SPropertyTemplatePath = TTemplatePath; /** CGameTemplate - Per-game template data */ class CGameTemplate @@ -106,12 +106,12 @@ public: CScriptTemplate* FindMiscTemplate(const TString& kTemplateName); TString GetGameDirectory() const; - // Inline Accessors - inline EGame Game() const { return mGame; } - inline uint32 NumScriptTemplates() const { return mScriptTemplates.size(); } - inline uint32 NumStates() const { return mStates.size(); } - inline uint32 NumMessages() const { return mMessages.size(); } - inline bool IsLoadedSuccessfully() { return mFullyLoaded; } + // Accessors + EGame Game() const { return mGame; } + uint32 NumScriptTemplates() const { return mScriptTemplates.size(); } + uint32 NumStates() const { return mStates.size(); } + uint32 NumMessages() const { return mMessages.size(); } + bool IsLoadedSuccessfully() const { return mFullyLoaded; } }; #endif // CGAMETEMPLATE_H diff --git a/src/Core/Resource/Script/CLink.h b/src/Core/Resource/Script/CLink.h index 4203eafc..6d59de1a 100644 --- a/src/Core/Resource/Script/CLink.h +++ b/src/Core/Resource/Script/CLink.h @@ -63,18 +63,14 @@ struct SMessage class CLink { CGameArea *mpArea; - uint32 mStateID; - uint32 mMessageID; - uint32 mSenderID; - uint32 mReceiverID; + uint32 mStateID = UINT32_MAX; + uint32 mMessageID = UINT32_MAX; + uint32 mSenderID = UINT32_MAX; + uint32 mReceiverID = UINT32_MAX; public: CLink(CGameArea *pArea) : mpArea(pArea) - , mStateID(-1) - , mMessageID(-1) - , mSenderID(-1) - , mReceiverID(-1) {} CLink(CGameArea *pArea, uint32 StateID, uint32 MessageID, uint32 SenderID, uint32 ReceiverID) @@ -140,31 +136,31 @@ public: } // Operators - bool operator==(const CLink& rkOther) + bool operator==(const CLink& rkOther) const { - return ( (mpArea == rkOther.mpArea) && - (mStateID == rkOther.mStateID) && - (mMessageID == rkOther.mMessageID) && - (mSenderID == rkOther.mSenderID) && - (mReceiverID == rkOther.mReceiverID) ); + return (mpArea == rkOther.mpArea) && + (mStateID == rkOther.mStateID) && + (mMessageID == rkOther.mMessageID) && + (mSenderID == rkOther.mSenderID) && + (mReceiverID == rkOther.mReceiverID); } - bool operator!=(const CLink& rkOther) + bool operator!=(const CLink& rkOther) const { return (!(*this == rkOther)); } // Accessors - inline CGameArea* Area() const { return mpArea; } - inline uint32 State() const { return mStateID; } - inline uint32 Message() const { return mMessageID; } - inline uint32 SenderID() const { return mSenderID; } - inline uint32 ReceiverID() const { return mReceiverID; } - inline CScriptObject* Sender() const { return mpArea->InstanceByID(mSenderID); } - inline CScriptObject* Receiver() const { return mpArea->InstanceByID(mReceiverID); } + CGameArea* Area() const { return mpArea; } + uint32 State() const { return mStateID; } + uint32 Message() const { return mMessageID; } + uint32 SenderID() const { return mSenderID; } + uint32 ReceiverID() const { return mReceiverID; } + CScriptObject* Sender() const { return mpArea->InstanceByID(mSenderID); } + CScriptObject* Receiver() const { return mpArea->InstanceByID(mReceiverID); } - inline void SetState(uint32 StateID) { mStateID = StateID; } - inline void SetMessage(uint32 MessageID) { mMessageID = MessageID; } + void SetState(uint32 StateID) { mStateID = StateID; } + void SetMessage(uint32 MessageID) { mMessageID = MessageID; } }; diff --git a/src/Core/Resource/Script/CScriptLayer.h b/src/Core/Resource/Script/CScriptLayer.h index b516e8a6..55af6df3 100644 --- a/src/Core/Resource/Script/CScriptLayer.h +++ b/src/Core/Resource/Script/CScriptLayer.h @@ -11,15 +11,13 @@ class CScriptLayer { CGameArea *mpArea; TString mLayerName; - bool mActive; - bool mVisible; + bool mActive = true; + bool mVisible = true; std::vector mInstances; public: CScriptLayer(CGameArea *pArea) : mpArea(pArea) , mLayerName("New Layer") - , mActive(true) - , mVisible(true) { } @@ -78,14 +76,14 @@ public: } // Accessors - inline CGameArea* Area() const { return mpArea; } - inline TString Name() const { return mLayerName; } - inline bool IsActive() const { return mActive; } - inline bool IsVisible() const { return mVisible; } - inline uint32 NumInstances() const { return mInstances.size(); } - inline CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; } + CGameArea* Area() const { return mpArea; } + TString Name() const { return mLayerName; } + bool IsActive() const { return mActive; } + bool IsVisible() const { return mVisible; } + uint32 NumInstances() const { return mInstances.size(); } + CScriptObject* InstanceByIndex(uint32 Index) const { return mInstances[Index]; } - inline CScriptObject* InstanceByID(uint32 ID) const + CScriptObject* InstanceByID(uint32 ID) const { for (auto it = mInstances.begin(); it != mInstances.end(); it++) { @@ -96,11 +94,11 @@ public: return nullptr; } - inline void SetName(const TString& rkName) { mLayerName = rkName; } - inline void SetActive(bool Active) { mActive = Active; } - inline void SetVisible(bool Visible) { mVisible = Visible; } + void SetName(const TString& rkName) { mLayerName = rkName; } + void SetActive(bool Active) { mActive = Active; } + void SetVisible(bool Visible) { mVisible = Visible; } - inline uint32 AreaIndex() const + uint32 AreaIndex() const { for (uint32 iLyr = 0; iLyr < mpArea->NumScriptLayers(); iLyr++) { diff --git a/src/Core/Resource/Script/CScriptObject.cpp b/src/Core/Resource/Script/CScriptObject.cpp index d9c7b02d..b8b78118 100644 --- a/src/Core/Resource/Script/CScriptObject.cpp +++ b/src/Core/Resource/Script/CScriptObject.cpp @@ -7,10 +7,7 @@ CScriptObject::CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer * : mpTemplate(pTemplate) , mpArea(pArea) , mpLayer(pLayer) - , mVersion(0) , mInstanceID(InstanceID) - , mHasInGameModel(false) - , mIsCheckingNearVisibleActivation(false) { mpTemplate->AddObject(this); diff --git a/src/Core/Resource/Script/CScriptObject.h b/src/Core/Resource/Script/CScriptObject.h index d9696f2a..d9b30433 100644 --- a/src/Core/Resource/Script/CScriptObject.h +++ b/src/Core/Resource/Script/CScriptObject.h @@ -20,13 +20,13 @@ class CInstanceID { uint32 mId = 0; public: - operator uint32() const { return mId; } - CInstanceID() = default; - CInstanceID(uint32 id) : mId(id) {} - CInstanceID& operator=(uint32 id) { mId = id; return *this; } - uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); } - uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); } - uint16 Id() const { return uint16(mId & 0xffffu); } + constexpr operator uint32() const { return mId; } + constexpr CInstanceID() = default; + constexpr CInstanceID(uint32 id) : mId(id) {} + constexpr CInstanceID& operator=(uint32 id) { mId = id; return *this; } + [[nodiscard]] constexpr uint8 Layer() const { return uint8((mId >> 26u) & 0x3fu); } + [[nodiscard]] constexpr uint16 Area() const { return uint16((mId >> 16u) & 0x3ffu); } + [[nodiscard]] constexpr uint16 Id() const { return uint16(mId & 0xffffu); } }; class CScriptObject @@ -37,7 +37,7 @@ class CScriptObject CScriptTemplate *mpTemplate; CGameArea *mpArea; CScriptLayer *mpLayer; - uint32 mVersion; + uint32 mVersion = 0; CInstanceID mInstanceID; std::vector mOutLinks; @@ -53,15 +53,15 @@ class CScriptObject TResPtr mpDisplayAsset; TResPtr mpCollision; - uint32 mActiveCharIndex; - uint32 mActiveAnimIndex; - bool mHasInGameModel; + uint32 mActiveCharIndex = 0; + uint32 mActiveAnimIndex = 0; + bool mHasInGameModel = false; - EVolumeShape mVolumeShape; - float mVolumeScale; + EVolumeShape mVolumeShape{}; + float mVolumeScale = 0.0f; // Recursion guard - mutable bool mIsCheckingNearVisibleActivation; + mutable bool mIsCheckingNearVisibleActivation = false; public: CScriptObject(uint32 InstanceID, CGameArea *pArea, CScriptLayer *pLayer, CScriptTemplate *pTemplate); diff --git a/src/Core/Resource/Script/CScriptTemplate.cpp b/src/Core/Resource/Script/CScriptTemplate.cpp index c9759252..569f0d26 100644 --- a/src/Core/Resource/Script/CScriptTemplate.cpp +++ b/src/Core/Resource/Script/CScriptTemplate.cpp @@ -5,45 +5,19 @@ #include "Core/Resource/Animation/CAnimSet.h" #include -#include #include // Old constructor CScriptTemplate::CScriptTemplate(CGameTemplate *pGame) : mpGame(pGame) - , mpProperties(nullptr) - , mVisible(true) - , mDirty(false) - , mpNameProperty(nullptr) - , mpPositionProperty(nullptr) - , mpRotationProperty(nullptr) - , mpScaleProperty(nullptr) - , mpActiveProperty(nullptr) - , mpLightParametersProperty(nullptr) - , mPreviewScale(1.f) - , mVolumeShape(EVolumeShape::NoShape) - , mVolumeScale(1.f) { } // New constructor CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, const TString& kInFilePath) - : mRotationType(ERotationType::RotationEnabled) - , mScaleType(EScaleType::ScaleEnabled) - , mPreviewScale(1.f) - , mVolumeShape(EVolumeShape::NoShape) - , mVolumeScale(1.f) - , mSourceFile(kInFilePath) + : mSourceFile(kInFilePath) , mObjectID(InObjectID) , mpGame(pInGame) - , mpNameProperty(nullptr) - , mpPositionProperty(nullptr) - , mpRotationProperty(nullptr) - , mpScaleProperty(nullptr) - , mpActiveProperty(nullptr) - , mpLightParametersProperty(nullptr) - , mVisible(true) - , mDirty(false) { // Load CXMLReader Reader(kInFilePath); @@ -62,9 +36,7 @@ CScriptTemplate::CScriptTemplate(CGameTemplate* pInGame, uint32 InObjectID, cons if (!mLightParametersIDString.IsEmpty()) mpLightParametersProperty = TPropCast( mpProperties->ChildByIDString(mLightParametersIDString) ); } -CScriptTemplate::~CScriptTemplate() -{ -} +CScriptTemplate::~CScriptTemplate() = default; void CScriptTemplate::Serialize(IArchive& Arc) { diff --git a/src/Core/Resource/Script/CScriptTemplate.h b/src/Core/Resource/Script/CScriptTemplate.h index bd4bf048..aac77e8d 100644 --- a/src/Core/Resource/Script/CScriptTemplate.h +++ b/src/Core/Resource/Script/CScriptTemplate.h @@ -80,17 +80,17 @@ private: std::vector mAssets; std::vector mAttachments; - ERotationType mRotationType; - EScaleType mScaleType; - float mPreviewScale; + ERotationType mRotationType{ERotationType::RotationEnabled}; + EScaleType mScaleType{EScaleType::ScaleEnabled}; + float mPreviewScale = 1.0f; // Preview Volume - EVolumeShape mVolumeShape; - float mVolumeScale; + EVolumeShape mVolumeShape{EVolumeShape::NoShape}; + float mVolumeScale = 1.0f; TIDString mVolumeConditionIDString; TString mSourceFile; - uint32 mObjectID; + uint32 mObjectID = 0; // Editor Properties TIDString mNameIDString; @@ -103,12 +103,12 @@ private: CGameTemplate* mpGame; std::list mObjectList; - CStringProperty* mpNameProperty; - CVectorProperty* mpPositionProperty; - CVectorProperty* mpRotationProperty; - CVectorProperty* mpScaleProperty; - CBoolProperty* mpActiveProperty; - CStructProperty* mpLightParametersProperty; + CStringProperty* mpNameProperty = nullptr; + CVectorProperty* mpPositionProperty = nullptr; + CVectorProperty* mpRotationProperty = nullptr; + CVectorProperty* mpScaleProperty = nullptr; + CBoolProperty* mpActiveProperty = nullptr; + CStructProperty* mpLightParametersProperty = nullptr; struct SVolumeCondition { uint32 Value; @@ -123,14 +123,14 @@ private: } }; std::vector mVolumeConditions; - bool mVisible; - bool mDirty; + bool mVisible = true; + bool mDirty = false; public: // Default constructor. Don't use. This is only here so the serializer doesn't complain CScriptTemplate() { ASSERT(false); } // Old constructor - CScriptTemplate(CGameTemplate *pGame); + explicit CScriptTemplate(CGameTemplate *pGame); // New constructor CScriptTemplate(CGameTemplate* pGame, uint32 ObjectID, const TString& kFilePath); ~CScriptTemplate(); @@ -145,29 +145,29 @@ public: CCollisionMeshGroup* FindCollision(void* pPropertyData); // Accessors - inline CGameTemplate* GameTemplate() const { return mpGame; } - inline TString Name() const { return mpProperties->Name(); } - inline ERotationType RotationType() const { return mRotationType; } - inline EScaleType ScaleType() const { return mScaleType; } - inline float PreviewScale() const { return mPreviewScale; } - inline uint32 ObjectID() const { return mObjectID; } - inline bool IsVisible() const { return mVisible; } - inline TString SourceFile() const { return mSourceFile; } - inline CStructProperty* Properties() const { return mpProperties.get(); } - inline uint32 NumAttachments() const { return mAttachments.size(); } + CGameTemplate* GameTemplate() const { return mpGame; } + TString Name() const { return mpProperties->Name(); } + ERotationType RotationType() const { return mRotationType; } + EScaleType ScaleType() const { return mScaleType; } + float PreviewScale() const { return mPreviewScale; } + uint32 ObjectID() const { return mObjectID; } + bool IsVisible() const { return mVisible; } + TString SourceFile() const { return mSourceFile; } + CStructProperty* Properties() const { return mpProperties.get(); } + uint32 NumAttachments() const { return mAttachments.size(); } const SAttachment& Attachment(uint32 Index) const { return mAttachments[Index]; } const std::vector& RequiredModules() const { return mModules; } - inline CStringProperty* NameProperty() const { return mpNameProperty; } - inline CVectorProperty* PositionProperty() const { return mpPositionProperty; } - inline CVectorProperty* RotationProperty() const { return mpRotationProperty; } - inline CVectorProperty* ScaleProperty() const { return mpScaleProperty; } - inline CBoolProperty* ActiveProperty() const { return mpActiveProperty; } - inline CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; } + CStringProperty* NameProperty() const { return mpNameProperty; } + CVectorProperty* PositionProperty() const { return mpPositionProperty; } + CVectorProperty* RotationProperty() const { return mpRotationProperty; } + CVectorProperty* ScaleProperty() const { return mpScaleProperty; } + CBoolProperty* ActiveProperty() const { return mpActiveProperty; } + CStructProperty* LightParametersProperty() const { return mpLightParametersProperty; } - inline void SetVisible(bool Visible) { mVisible = Visible; } - inline void MarkDirty() { mDirty = true; } - inline bool IsDirty() const { return mDirty || mpProperties->IsDirty(); } + void SetVisible(bool Visible) { mVisible = Visible; } + void MarkDirty() { mDirty = true; } + bool IsDirty() const { return mDirty || mpProperties->IsDirty(); } // Object Tracking uint32 NumObjects() const; diff --git a/src/Core/Resource/Script/NPropertyMap.h b/src/Core/Resource/Script/NPropertyMap.h index 9d81e11e..e8182427 100644 --- a/src/Core/Resource/Script/NPropertyMap.h +++ b/src/Core/Resource/Script/NPropertyMap.h @@ -66,7 +66,7 @@ public: const char* Name() const; const char* TypeName() const; - operator bool() const; + explicit operator bool() const; void operator ++(); }; diff --git a/src/Core/Resource/Script/Property/IProperty.cpp b/src/Core/Resource/Script/Property/IProperty.cpp index 620a87eb..534d00ee 100644 --- a/src/Core/Resource/Script/Property/IProperty.cpp +++ b/src/Core/Resource/Script/Property/IProperty.cpp @@ -14,16 +14,7 @@ /** IProperty */ IProperty::IProperty(EGame Game) - : mpParent( nullptr ) - , mpPointerParent( nullptr ) - , mpArchetype( nullptr ) - , mGame( Game ) - , mpScriptTemplate( nullptr ) - , mOffset( -1 ) - , mID( -1 ) - , mCookPreference( ECookPreference::Default ) - , mMinVersion( 0.0f ) - , mMaxVersion( FLT_MAX ) + : mGame(Game) {} void IProperty::_ClearChildren() diff --git a/src/Core/Resource/Script/Property/IProperty.h b/src/Core/Resource/Script/Property/IProperty.h index 63a20a44..81e01784 100644 --- a/src/Core/Resource/Script/Property/IProperty.h +++ b/src/Core/Resource/Script/Property/IProperty.h @@ -13,33 +13,33 @@ class CGameTemplate; class CScriptTemplate; class CStructProperty; -/** Typedefs */ -typedef TString TIDString; +/** Aliases */ +using TIDString = TString; /** Property flags */ enum class EPropertyFlag : uint32 { /** Property has been fully initialized and has had PostLoad called */ - IsInitialized = 0x1, + IsInitialized = 0x1, /** Property is an archetype (a template for other properties to copy from) */ - IsArchetype = 0x2, + IsArchetype = 0x2, /** Property is an array archetype (a template for elements of an array property) */ - IsArrayArchetype = 0x4, + IsArrayArchetype = 0x4, /** This property and all its children are a single unit and do not have individual property IDs, sizes, etc. */ - IsAtomic = 0x8, + IsAtomic = 0x8, /** This is a property of a C++ class, not a script object */ - IsIntrinsic = 0x10, + IsIntrinsic = 0x10, /** Property has been modified, and needs to be resaved. Only valid on archetypes */ - IsDirty = 0x20, + IsDirty = 0x20, /** We have cached whether the property name is correct */ - HasCachedNameCheck = 0x40000000, + HasCachedNameCheck = 0x40000000, /** The name of the property is a match for the property ID hash */ - HasCorrectPropertyName = 0x80000000, + HasCorrectPropertyName = 0x80000000, /** Flags that are left intact when copying from an archetype */ - ArchetypeCopyFlags = EPropertyFlag::IsAtomic, + ArchetypeCopyFlags = IsAtomic, /** Flags that are inheritable from parent */ - InheritableFlags = EPropertyFlag::IsArchetype | EPropertyFlag::IsArrayArchetype | EPropertyFlag::IsAtomic, + InheritableFlags = IsArchetype | IsArrayArchetype | IsAtomic, }; DECLARE_FLAGS_ENUMCLASS(EPropertyFlag, FPropertyFlags) @@ -117,14 +117,14 @@ protected: FPropertyFlags mFlags; /** Parent property */ - IProperty* mpParent; + IProperty* mpParent = nullptr; /** Pointer parent; if non-null, this parent needs to be dereferenced to access the correct * memory region that our property data is stored in */ - IProperty* mpPointerParent; + IProperty* mpPointerParent = nullptr; /** Archetype property; source property that we copied metadata from */ - IProperty* mpArchetype; + IProperty* mpArchetype = nullptr; /** Sub-instances of archetype properties. For non-archetypes, will be empty. * @todo this really oughta be a linked list */ @@ -137,29 +137,29 @@ protected: EGame mGame; /** Script template that this property belongs to. Null for struct/enum/flag archetypes. */ - CScriptTemplate* mpScriptTemplate; + CScriptTemplate* mpScriptTemplate = nullptr; /** Offset of this property within the property block */ - uint32 mOffset; + uint32 mOffset = UINT32_MAX; /** Property ID. This ID is used to uniquely identify this property within this struct. */ - uint32 mID; + uint32 mID = UINT32_MAX; /** Property metadata */ TString mName; TString mDescription; TString mSuffix; - ECookPreference mCookPreference; + ECookPreference mCookPreference{ECookPreference::Default}; /** Min/max allowed version number. These numbers correspond to the game's internal build number. * This is not used yet but in the future it can be used to configure certain properties to only * show up when certain versions of the game are being edited. The default values allow the * property to show up in all versions. */ - float mMinVersion; - float mMaxVersion; + float mMinVersion = 0.0f; + float mMaxVersion = FLT_MAX; /** Private constructor - use static methods to instantiate */ - IProperty(EGame Game); + explicit IProperty(EGame Game); void _ClearChildren(); public: @@ -207,29 +207,69 @@ public: /** Accessors */ EGame Game() const; - inline ECookPreference CookPreference() const; - inline uint32 NumChildren() const; - inline IProperty* ChildByIndex(uint32 ChildIndex) const; - inline IProperty* Parent() const; - inline IProperty* RootParent(); - inline IProperty* Archetype() const; - inline IProperty* RootArchetype(); - inline CScriptTemplate* ScriptTemplate() const; - inline TString Name() const; - inline TString Description() const; - inline TString Suffix() const; - inline TIDString IDString(bool FullyQualified) const; - inline uint32 Offset() const; - inline uint32 ID() const; + ECookPreference CookPreference() const { return mCookPreference; } + uint32 NumChildren() const { return mChildren.size(); } - inline bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); } - inline bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); } - inline bool IsArrayArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArrayArchetype); } - inline bool IsAtomic() const { return mFlags.HasFlag(EPropertyFlag::IsAtomic); } - inline bool IsIntrinsic() const { return mFlags.HasFlag(EPropertyFlag::IsIntrinsic); } - inline bool IsDirty() const { return mFlags.HasFlag(EPropertyFlag::IsDirty); } - inline bool IsRootParent() const { return mpParent == nullptr; } - inline bool IsRootArchetype() const { return mpArchetype == nullptr; } + IProperty* ChildByIndex(uint32 ChildIndex) const + { + ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size()); + return mChildren[ChildIndex]; + } + + IProperty* Parent() const { return mpParent; } + IProperty* RootParent() + { + IProperty* pParent = Parent(); + IProperty* pOut = this; + + while (pParent) + { + pOut = pParent; + pParent = pParent->Parent(); + } + + return pOut; + } + + IProperty* Archetype() const { return mpArchetype; } + IProperty* RootArchetype() + { + IProperty* pArchetype = Archetype(); + IProperty* pOut = this; + + while (pArchetype) + { + pOut = pArchetype; + pArchetype = pArchetype->Archetype(); + } + + return pOut; + } + + CScriptTemplate* ScriptTemplate() const { return mpScriptTemplate; } + TString Name() const { return mName; } + TString Description() const { return mDescription; } + TString Suffix() const { return mSuffix; } + + TIDString IDString(bool FullyQualified) const + { + if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr) + return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID); + else + return TString::HexString(mID); + } + + uint32 Offset() const { return mOffset; } + uint32 ID() const { return mID; } + + bool IsInitialized() const { return mFlags.HasFlag(EPropertyFlag::IsInitialized); } + bool IsArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArchetype); } + bool IsArrayArchetype() const { return mFlags.HasFlag(EPropertyFlag::IsArrayArchetype); } + bool IsAtomic() const { return mFlags.HasFlag(EPropertyFlag::IsAtomic); } + bool IsIntrinsic() const { return mFlags.HasFlag(EPropertyFlag::IsIntrinsic); } + bool IsDirty() const { return mFlags.HasFlag(EPropertyFlag::IsDirty); } + bool IsRootParent() const { return mpParent == nullptr; } + bool IsRootArchetype() const { return mpArchetype == nullptr; } /** Create */ static IProperty* Create(EPropertyType Type, @@ -251,130 +291,42 @@ public: const IArchive& Arc); }; -inline ECookPreference IProperty::CookPreference() const -{ - return mCookPreference; -} - -inline uint32 IProperty::NumChildren() const -{ - return mChildren.size(); -} - -inline IProperty* IProperty::ChildByIndex(uint32 ChildIndex) const -{ - ASSERT(ChildIndex >= 0 && ChildIndex < mChildren.size()); - return mChildren[ChildIndex]; -} - -inline IProperty* IProperty::Parent() const -{ - return mpParent; -} - -inline IProperty* IProperty::RootParent() -{ - IProperty* pParent = Parent(); - IProperty* pOut = this; - - while (pParent) - { - pOut = pParent; - pParent = pParent->Parent(); - } - - return pOut; -} - -inline IProperty* IProperty::Archetype() const -{ - return mpArchetype; -} - -inline IProperty* IProperty::RootArchetype() -{ - IProperty* pArchetype = Archetype(); - IProperty* pOut = this; - - while (pArchetype) - { - pOut = pArchetype; - pArchetype = pArchetype->Archetype(); - } - - return pOut; -} - -inline CScriptTemplate* IProperty::ScriptTemplate() const -{ - return mpScriptTemplate; -} - -inline TString IProperty::Name() const -{ - return mName; -} - -inline TString IProperty::Description() const -{ - return mDescription; -} - -inline TString IProperty::Suffix() const -{ - return mSuffix; -} - -inline TString IProperty::IDString(bool FullyQualified) const -{ - if (FullyQualified && mpParent != nullptr && mpParent->Parent() != nullptr) - return mpParent->IDString(FullyQualified) + ":" + TString::HexString(mID); - else - return TString::HexString(mID); -} - -inline uint32 IProperty::Offset() const -{ - return mOffset; -} - -inline uint32 IProperty::ID() const -{ - return mID; -} - template class TTypedProperty : public IProperty { friend class IProperty; friend class CTemplateLoader; public: - typedef PropType ValueType; + using ValueType = PropType; protected: PropType mDefaultValue = {}; - TTypedProperty(EGame Game) : IProperty(Game) {} + explicit TTypedProperty(EGame Game) : IProperty(Game) {} public: - virtual EPropertyType Type() const { return PropEnum; } - virtual uint32 DataSize() const { return sizeof(PropType); } - virtual uint32 DataAlignment() const { return alignof(PropType); } - virtual void Construct(void* pData) const { new(ValuePtr(pData)) PropType(mDefaultValue); } - virtual void Destruct(void* pData) const { ValueRef(pData).~PropType(); } - virtual bool MatchesDefault(void* pData) const { return ValueRef(pData) == mDefaultValue; } - virtual void RevertToDefault(void* pData) const { ValueRef(pData) = mDefaultValue; } - virtual void SetDefaultFromData(void* pData) { mDefaultValue = ValueRef(pData); MarkDirty(); } + EPropertyType Type() const override { return PropEnum; } + uint32 DataSize() const override { return sizeof(PropType); } + uint32 DataAlignment() const override { return alignof(PropType); } + void Construct(void* pData) const override { new (ValuePtr(pData)) PropType(mDefaultValue); } + void Destruct(void* pData) const override { ValueRef(pData).~PropType(); } + bool MatchesDefault(void* pData) const override { return ValueRef(pData) == mDefaultValue; } + void RevertToDefault(void* pData) const override { ValueRef(pData) = mDefaultValue; } + void SetDefaultFromData(void* pData) override + { + mDefaultValue = ValueRef(pData); + MarkDirty(); + } virtual bool CanHaveDefault() const { return true; } - virtual void InitFromArchetype(IProperty* pOther) + void InitFromArchetype(IProperty* pOther) override { IProperty::InitFromArchetype(pOther); mDefaultValue = static_cast(pOther)->mDefaultValue; } - virtual void CopyDefaultValueTo(IProperty* pOtherProperty) + void CopyDefaultValueTo(IProperty* pOtherProperty) override { // WARNING: We don't do any type checking here because this function is used for type conversion, // which necessitates that the property class is allowed to be different. The underlying type is @@ -384,32 +336,32 @@ public: pTypedOther->mDefaultValue = mDefaultValue; } - inline PropType* ValuePtr(void* pData) const + PropType* ValuePtr(void* pData) const { return (PropType*) RawValuePtr(pData); } - inline PropType& ValueRef(void* pData) const + PropType& ValueRef(void* pData) const { return *ValuePtr(pData); } - inline PropType Value(void* pData) const + PropType Value(void* pData) const { return *ValuePtr(pData); } - inline const PropType& DefaultValue() const + const PropType& DefaultValue() const { return mDefaultValue; } - inline void SetDefaultValue(const PropType& kInDefaultValue) + void SetDefaultValue(const PropType& kInDefaultValue) { mDefaultValue = kInDefaultValue; } - inline static EPropertyType StaticType() { return PropEnum; } + static EPropertyType StaticType() { return PropEnum; } }; template @@ -417,12 +369,12 @@ class TSerializeableTypedProperty : public TTypedProperty { using base = TTypedProperty; protected: - TSerializeableTypedProperty(EGame Game) + explicit TSerializeableTypedProperty(EGame Game) : base(Game) {} public: - virtual void Serialize(IArchive& rArc) + void Serialize(IArchive& rArc) override { base::Serialize(rArc); TSerializeableTypedProperty* pArchetype = static_cast(base::mpArchetype); @@ -462,7 +414,7 @@ public: rArc << SerialParameter("DefaultValue", base::mDefaultValue); } - virtual bool ShouldSerialize() const + bool ShouldSerialize() const override { base* pArchetype = static_cast(base::mpArchetype); @@ -485,17 +437,15 @@ class TNumericalProperty : public TSerializeableTypedProperty(base::mpArchetype); @@ -504,7 +454,7 @@ public: << SerialParameter("Max", mMaxValue, SH_Optional, pArchetype ? pArchetype->mMaxValue : (PropType) -1); } - virtual bool ShouldSerialize() const + bool ShouldSerialize() const override { TNumericalProperty* pArchetype = static_cast(base::mpArchetype); return base::ShouldSerialize() || @@ -512,7 +462,7 @@ public: mMaxValue != pArchetype->mMaxValue; } - virtual void InitFromArchetype(IProperty* pOther) + void InitFromArchetype(IProperty* pOther) override { base::InitFromArchetype(pOther); TNumericalProperty* pCastOther = static_cast(pOther); @@ -520,7 +470,7 @@ public: mMaxValue = pCastOther->mMaxValue; } - virtual void PropertyValueChanged(void* pPropertyData) + void PropertyValueChanged(void* pPropertyData) override { base::PropertyValueChanged(pPropertyData); @@ -534,7 +484,7 @@ public: /** Property casting with dynamic type checking */ template -inline PropertyClass* TPropCast(IProperty* pProperty) +PropertyClass* TPropCast(IProperty* pProperty) { if (pProperty && pProperty->Type() == PropertyClass::StaticType()) { diff --git a/src/Core/Resource/Script/Property/TPropertyRef.h b/src/Core/Resource/Script/Property/TPropertyRef.h index 5adb3369..80f8c6bb 100644 --- a/src/Core/Resource/Script/Property/TPropertyRef.h +++ b/src/Core/Resource/Script/Property/TPropertyRef.h @@ -27,15 +27,13 @@ template(pInProperty) ) @@ -48,19 +46,19 @@ public: } /** Accessors */ - inline void* DataPointer() const { return mpPropertyData; } - inline PropertyClass* Property() const { return mpProperty; } - inline ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); } - inline void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; } - inline bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; } + void* DataPointer() const { return mpPropertyData; } + PropertyClass* Property() const { return mpProperty; } + ValueType Get() const { return IsValid() ? *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) : ValueType(); } + void Set(const ValueType& kIn) const { if (IsValid()) *((ValueType*) mpProperty->RawValuePtr( mpPropertyData )) = kIn; } + bool IsValid() const { return mpPropertyData != nullptr && mpProperty != nullptr; } /** Inline operators */ - inline operator ValueType() const + operator ValueType() const { return Get(); } - inline bool operator==(IProperty* pProperty) const + bool operator==(IProperty* pProperty) const { return mpProperty == pProperty; } @@ -72,25 +70,25 @@ public: }; /** Convenience typedefs */ -typedef TPropertyRef CBoolRef; -typedef TPropertyRef CByteRef; -typedef TPropertyRef CShortRef; -typedef TPropertyRef CIntRef; -typedef TPropertyRef CFloatRef; -typedef TPropertyRef CFlagsRef; -typedef TPropertyRef CStringRef; -typedef TPropertyRef CVectorRef; -typedef TPropertyRef CColorRef; -typedef TPropertyRef CAssetRef; -typedef TPropertyRef CSoundRef; -typedef TPropertyRef CAnimationRef; -typedef TPropertyRef CAnimationSetRef; -typedef TPropertyRef CSequenceRef; -typedef TPropertyRef CSplineRef; -typedef TPropertyRef CGuidRef; -typedef TPropertyRef CPointerRef; -typedef TPropertyRef CStructRef; -typedef TPropertyRef CArrayRef; +using CAnimationRef = TPropertyRef; +using CAnimationSetRef = TPropertyRef; +using CArrayRef = TPropertyRef; +using CAssetRef = TPropertyRef; +using CBoolRef = TPropertyRef; +using CByteRef = TPropertyRef; +using CColorRef = TPropertyRef; +using CFlagsRef = TPropertyRef; +using CFloatRef = TPropertyRef; +using CGuidRef = TPropertyRef; +using CIntRef = TPropertyRef; +using CPointerRef = TPropertyRef; +using CSequenceRef = TPropertyRef; +using CShortRef = TPropertyRef; +using CSoundRef = TPropertyRef; +using CSplineRef = TPropertyRef; +using CStringRef = TPropertyRef; +using CStructRef = TPropertyRef; +using CVectorRef = TPropertyRef; /** Special version for enums */ template diff --git a/src/Core/Resource/StringTable/CStringTable.h b/src/Core/Resource/StringTable/CStringTable.h index a414711b..4995aa8b 100644 --- a/src/Core/Resource/StringTable/CStringTable.h +++ b/src/Core/Resource/StringTable/CStringTable.h @@ -24,11 +24,9 @@ class CStringTable : public CResource struct SStringData { TString String; - bool IsLocalized; + bool IsLocalized = false; - SStringData() - : IsLocalized(false) - {} + SStringData() = default; void Serialize(IArchive& Arc) { @@ -52,19 +50,19 @@ class CStringTable : public CResource public: /** Constructor */ - CStringTable(CResourceEntry *pEntry = 0) : CResource(pEntry) {} + explicit CStringTable(CResourceEntry *pEntry = nullptr) : CResource(pEntry) {} /** Returns the number of languages in the table */ - inline uint NumLanguages() const { return mLanguages.size(); } + uint NumLanguages() const { return mLanguages.size(); } /** Returns the number of strings in the table */ - inline uint NumStrings() const { return mLanguages.empty() ? 0 : mLanguages[0].Strings.size(); } + uint NumStrings() const { return mLanguages.empty() ? 0 : mLanguages[0].Strings.size(); } /** Returns languages used by index */ - inline ELanguage LanguageByIndex(uint Index) const { return mLanguages.size() > Index ? mLanguages[Index].Language : ELanguage::Invalid; } + ELanguage LanguageByIndex(uint Index) const { return mLanguages.size() > Index ? mLanguages[Index].Language : ELanguage::Invalid; } /** Returns the string name by string index. May be blank if the string at the requested index is unnamed */ - inline TString StringNameByIndex(uint Index) const { return mStringNames.size() > Index ? mStringNames[Index] : ""; } + TString StringNameByIndex(uint Index) const { return mStringNames.size() > Index ? mStringNames[Index] : ""; } /** Returns a string given a language/index pair */ TString GetString(ELanguage Language, uint StringIndex) const; @@ -85,13 +83,13 @@ public: void RemoveString(uint StringIndex); /** Initialize new resource data */ - virtual void InitializeNewResource() override; + void InitializeNewResource() override; /** Serialize resource data */ - virtual void Serialize(IArchive& Arc) override; + void Serialize(IArchive& Arc) override; /** Build the dependency tree for this resource */ - virtual CDependencyTree* BuildDependencyTree() const override; + CDependencyTree* BuildDependencyTree() const override; /** Static - Strip all formatting tags for a given string */ static TString StripFormatting(const TString& kInString); diff --git a/src/Core/SRayIntersection.h b/src/Core/SRayIntersection.h index 0c51ed56..1ae24312 100644 --- a/src/Core/SRayIntersection.h +++ b/src/Core/SRayIntersection.h @@ -8,15 +8,13 @@ class CSceneNode; struct SRayIntersection { - bool Hit; - float Distance; - CVector3f HitPoint; - CSceneNode *pNode; - uint ComponentIndex; - - SRayIntersection() - : Hit(false), Distance(0.f), HitPoint(CVector3f::skZero), pNode(nullptr), ComponentIndex(-1) {} + bool Hit = false; + float Distance = 0.0f; + CVector3f HitPoint{CVector3f::skZero}; + CSceneNode *pNode = nullptr; + uint ComponentIndex = UINT32_MAX; + SRayIntersection() = default; SRayIntersection(bool _Hit, float _Distance, CVector3f _HitPoint, CSceneNode *_pNode, uint _ComponentIndex) : Hit(_Hit), Distance(_Distance), HitPoint(_HitPoint), pNode(_pNode), ComponentIndex(_ComponentIndex) {} }; diff --git a/src/Core/Scene/CCollisionNode.h b/src/Core/Scene/CCollisionNode.h index 745b8bbf..59c29b91 100644 --- a/src/Core/Scene/CCollisionNode.h +++ b/src/Core/Scene/CCollisionNode.h @@ -9,12 +9,12 @@ class CCollisionNode : public CSceneNode TResPtr mpCollision; public: - CCollisionNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CCollisionMeshGroup *pCollision = 0); - ENodeType NodeType(); - void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo); + CCollisionNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CCollisionMeshGroup *pCollision = nullptr); + ENodeType NodeType() override; + void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override; void SetCollision(CCollisionMeshGroup *pCollision); }; diff --git a/src/Core/Scene/CLightNode.h b/src/Core/Scene/CLightNode.h index 2b76abb8..686dcec7 100644 --- a/src/Core/Scene/CLightNode.h +++ b/src/Core/Scene/CLightNode.h @@ -8,21 +8,21 @@ class CLightNode : public CSceneNode { CLight *mpLight; public: - CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CLight *Light = 0); - ENodeType NodeType(); - void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo); - void DrawSelection(); - void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay &Ray, uint32 AssetID, const SViewInfo& ViewInfo); - CStructRef GetProperties() const; - void PropertyModified(IProperty* pProperty); - bool AllowsRotate() const { return false; } + CLightNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CLight *Light = nullptr); + ENodeType NodeType() override; + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& ViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& ViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& Ray, uint32 AssetID, const SViewInfo& ViewInfo) override; + CStructRef GetProperties() const override; + void PropertyModified(IProperty* pProperty) override; + bool AllowsRotate() const override { return false; } CLight* Light(); CVector2f BillboardScale(); protected: - void CalculateTransform(CTransform4f& rOut) const; + void CalculateTransform(CTransform4f& rOut) const override; }; #endif // CLIGHTNODE_H diff --git a/src/Core/Scene/CModelNode.h b/src/Core/Scene/CModelNode.h index 7a52a2fd..4ce31894 100644 --- a/src/Core/Scene/CModelNode.h +++ b/src/Core/Scene/CModelNode.h @@ -17,29 +17,29 @@ class CModelNode : public CSceneNode public: explicit CModelNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CModel *pModel = 0); - virtual ENodeType NodeType(); - virtual void PostLoad(); - virtual void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo); - virtual void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - virtual void DrawSelection(); - virtual void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo); - virtual SRayIntersection RayNodeIntersectTest(const CRay &Ray, uint32 AssetID, const SViewInfo& rkViewInfo); - virtual CColor TintColor(const SViewInfo& rkViewInfo) const; + ENodeType NodeType() override; + void PostLoad() override; + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& Ray, uint32 AssetID, const SViewInfo& rkViewInfo) override; + CColor TintColor(const SViewInfo& rkViewInfo) const override; // Setters void SetModel(CModel *pModel); - inline void SetMatSet(uint32 MatSet) { mActiveMatSet = MatSet; } - inline void SetWorldModel(bool World) { mWorldModel = World; } - inline void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; } - inline void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; } - inline void ClearTintColor() { mTintColor = CColor::skWhite; } - inline void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; } - inline void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; } - inline CModel* Model() const { return mpModel; } - inline uint32 MatSet() const { return mActiveMatSet; } - inline bool IsWorldModel() const { return mWorldModel; } - inline uint32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; } + void SetMatSet(uint32 MatSet) { mActiveMatSet = MatSet; } + void SetWorldModel(bool World) { mWorldModel = World; } + void ForceAlphaEnabled(bool Enable) { mForceAlphaOn = Enable; } + void SetTintColor(const CColor& rkTintColor) { mTintColor = rkTintColor; } + void ClearTintColor() { mTintColor = CColor::skWhite; } + void SetScanOverlayEnabled(bool Enable) { mEnableScanOverlay = Enable; } + void SetScanOverlayColor(const CColor& rkColor) { mScanOverlayColor = rkColor; } + CModel* Model() const { return mpModel; } + uint32 MatSet() const { return mActiveMatSet; } + bool IsWorldModel() const { return mWorldModel; } + uint32 FindMeshID() const { return mpModel->GetSurface(0)->MeshID; } }; #endif // CMODELNODE_H diff --git a/src/Core/Scene/CRootNode.h b/src/Core/Scene/CRootNode.h index 3da12b8c..7465b6d0 100644 --- a/src/Core/Scene/CRootNode.h +++ b/src/Core/Scene/CRootNode.h @@ -2,29 +2,28 @@ #define CROOTNODE_H #include "CSceneNode.h" -#include // CRootNode's main purpose is to manage groups of other nodes as its children. class CRootNode : public CSceneNode { public: - explicit CRootNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0) + explicit CRootNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr) : CSceneNode(pScene, NodeID, pParent) {} - ~CRootNode() {} + ~CRootNode() = default; - ENodeType NodeType() + ENodeType NodeType() override { return ENodeType::Root; } - inline void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) {} + void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) override {} - inline SRayIntersection RayNodeIntersectTest(const CRay &, uint32, const SViewInfo&) + SRayIntersection RayNodeIntersectTest(const CRay &, uint32, const SViewInfo&) override { return SRayIntersection(); } - inline void DrawSelection() {} + void DrawSelection() override {} }; #endif // CROOTNODE_H diff --git a/src/Core/Scene/CSceneIterator.h b/src/Core/Scene/CSceneIterator.h index 1806eab6..872352dd 100644 --- a/src/Core/Scene/CSceneIterator.h +++ b/src/Core/Scene/CSceneIterator.h @@ -20,44 +20,44 @@ class CSceneIterator public: CSceneIterator(CScene *pScene, FNodeFlags AllowedNodeTypes = ENodeType::All, bool AllowHiddenNodes = false); - inline CSceneNode* Next() + CSceneNode* Next() { InternalFindNext(); return mpCurNode; } - inline bool DoneIterating() const + bool DoneIterating() const { return (mpCurNode == nullptr); } - inline CSceneNode* GetNode() const + CSceneNode* GetNode() const { return mpCurNode; } - inline operator bool() const + explicit operator bool() const { return !DoneIterating(); } - inline CSceneNode* operator*() const + CSceneNode* operator*() const { return mpCurNode; } - inline CSceneNode* operator->() const + CSceneNode* operator->() const { return mpCurNode; } - inline CSceneIterator& operator++() + CSceneIterator& operator++() { Next(); return *this; } - inline CSceneIterator operator++(int) + CSceneIterator operator++(int) { CSceneIterator Copy = *this; Next(); diff --git a/src/Core/Scene/CScriptAttachNode.h b/src/Core/Scene/CScriptAttachNode.h index ec0bbdfc..ad23b404 100644 --- a/src/Core/Scene/CScriptAttachNode.h +++ b/src/Core/Scene/CScriptAttachNode.h @@ -26,15 +26,15 @@ public: void ParentDisplayAssetChanged(CResource *pNewDisplayAsset); CModel* Model() const; - ENodeType NodeType() { return ENodeType::ScriptAttach; } - void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - void DrawSelection(); - void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo); + ENodeType NodeType() override { return ENodeType::ScriptAttach; } + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override; - inline IProperty* AttachProperty() const { return mpAttachAssetProp; } - inline TString LocatorName() const { return mLocatorName; } + IProperty* AttachProperty() const { return mpAttachAssetProp; } + TString LocatorName() const { return mLocatorName; } protected: void CalculateTransform(CTransform4f& rOut) const; diff --git a/src/Core/Scene/CScriptNode.cpp b/src/Core/Scene/CScriptNode.cpp index 9ba6e4e0..f2c6e6b5 100644 --- a/src/Core/Scene/CScriptNode.cpp +++ b/src/Core/Scene/CScriptNode.cpp @@ -13,11 +13,7 @@ CScriptNode::CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent, CScriptObject *pInstance) : CSceneNode(pScene, NodeID, pParent) - , mGameModeVisibility(EGameModeVisibility::Untested) - , mpVolumePreviewNode(nullptr) - , mHasVolumePreview(false) , mpInstance(pInstance) - , mpExtra(nullptr) { ASSERT(pInstance); diff --git a/src/Core/Scene/CScriptNode.h b/src/Core/Scene/CScriptNode.h index bf81d691..a6e549df 100644 --- a/src/Core/Scene/CScriptNode.h +++ b/src/Core/Scene/CScriptNode.h @@ -13,7 +13,7 @@ class CScriptExtra; class CScriptNode : public CSceneNode { CScriptObject *mpInstance; - CScriptExtra *mpExtra; + CScriptExtra *mpExtra = nullptr; TResPtr mpDisplayAsset; uint32 mCharIndex; @@ -21,34 +21,37 @@ class CScriptNode : public CSceneNode CCollisionNode *mpCollisionNode; std::vector mAttachments; - bool mHasValidPosition; - bool mHasVolumePreview; - CModelNode *mpVolumePreviewNode; + bool mHasValidPosition = false; + bool mHasVolumePreview = false; + CModelNode *mpVolumePreviewNode = nullptr; std::unique_ptr mpLightParameters; public: enum class EGameModeVisibility { - Visible, NotVisible, Untested - } mGameModeVisibility; + Visible, + NotVisible, + Untested, + }; + EGameModeVisibility mGameModeVisibility{EGameModeVisibility::Untested}; - CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CScriptObject *pObject = 0); - ENodeType NodeType(); - void PostLoad(); - void OnTransformed(); - void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - void DrawSelection(); - void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo); - bool AllowsRotate() const; - bool AllowsScale() const; - bool IsVisible() const; - CColor TintColor(const SViewInfo& rkViewInfo) const; - CColor WireframeColor() const; - CStructRef GetProperties() const; - void PropertyModified(IProperty* pProp); + CScriptNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CScriptObject *pObject = nullptr); + ENodeType NodeType() override; + void PostLoad() override; + void OnTransformed() override; + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override; + bool AllowsRotate() const override; + bool AllowsScale() const override; + bool IsVisible() const override; + CColor TintColor(const SViewInfo& rkViewInfo) const override; + CColor WireframeColor() const override; + CStructRef GetProperties() const override; + void PropertyModified(IProperty* pProp) override; void LinksModified(); void UpdatePreviewVolume(); @@ -69,9 +72,9 @@ public: CTexture* ActiveBillboard() const; bool UsesModel() const; - inline uint32 NumAttachments() const { return mAttachments.size(); } - inline CScriptAttachNode* Attachment(uint32 Index) const { return mAttachments[Index]; } - inline CResource* DisplayAsset() const { return mpDisplayAsset; } + uint32 NumAttachments() const { return mAttachments.size(); } + CScriptAttachNode* Attachment(uint32 Index) const { return mAttachments[Index]; } + CResource* DisplayAsset() const { return mpDisplayAsset; } protected: void SetDisplayAsset(CResource *pRes); diff --git a/src/Core/Scene/CStaticNode.h b/src/Core/Scene/CStaticNode.h index 1d835328..62f268dd 100644 --- a/src/Core/Scene/CStaticNode.h +++ b/src/Core/Scene/CStaticNode.h @@ -9,14 +9,14 @@ class CStaticNode : public CSceneNode CStaticModel *mpModel; public: - CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = 0, CStaticModel *pModel = 0); - ENodeType NodeType(); - void PostLoad(); - void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - void DrawSelection(); - void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo); + CStaticNode(CScene *pScene, uint32 NodeID, CSceneNode *pParent = nullptr, CStaticModel *pModel = nullptr); + ENodeType NodeType() override; + void PostLoad() override; + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override; }; #endif // CSTATICNODE_H diff --git a/src/Core/ScriptExtra/CDamageableTriggerExtra.h b/src/Core/ScriptExtra/CDamageableTriggerExtra.h index 5cf6a439..35516f6e 100644 --- a/src/Core/ScriptExtra/CDamageableTriggerExtra.h +++ b/src/Core/ScriptExtra/CDamageableTriggerExtra.h @@ -30,20 +30,20 @@ private: float mCachedRayDistance; public: - explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0); + explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr); ~CDamageableTriggerExtra(); void CreateMaterial(); void UpdatePlaneTransform(); ERenderSide RenderSideForDirection(const CVector3f& rkDir); ERenderSide TransformRenderSide(ERenderSide Side); - void OnTransformed(); - void PropertyModified(IProperty* pProperty); - bool ShouldDrawNormalAssets(); - void AddToRenderer(CRenderer *pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - void DrawSelection(); - void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 ComponentIndex, const SViewInfo& rkViewInfo); + void OnTransformed() override; + void PropertyModified(IProperty* pProperty) override; + bool ShouldDrawNormalAssets() override; + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 ComponentIndex, const SViewInfo& rkViewInfo) override; }; #endif // CDAMAGEABLETRIGGEREXTRA_H diff --git a/src/Core/ScriptExtra/CDoorExtra.h b/src/Core/ScriptExtra/CDoorExtra.h index fa55c94b..36ea4fb3 100644 --- a/src/Core/ScriptExtra/CDoorExtra.h +++ b/src/Core/ScriptExtra/CDoorExtra.h @@ -14,13 +14,13 @@ class CDoorExtra : public CScriptExtra CColor mShieldColor; public: - explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0); - void PropertyModified(IProperty* pProperty); - void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); - void DrawSelection(); - void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo); - SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo); + explicit CDoorExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr); + void PropertyModified(IProperty* pProperty) override; + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; + void DrawSelection() override; + void RayAABoxIntersectTest(CRayCollisionTester& rTester, const SViewInfo& rkViewInfo) override; + SRayIntersection RayNodeIntersectTest(const CRay& rkRay, uint32 AssetID, const SViewInfo& rkViewInfo) override; }; #endif // CDOOREXTRA_H diff --git a/src/Core/ScriptExtra/CPointOfInterestExtra.h b/src/Core/ScriptExtra/CPointOfInterestExtra.h index 6f878b3c..863bd9c3 100644 --- a/src/Core/ScriptExtra/CPointOfInterestExtra.h +++ b/src/Core/ScriptExtra/CPointOfInterestExtra.h @@ -14,8 +14,8 @@ class CPointOfInterestExtra : public CScriptExtra public: explicit CPointOfInterestExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0); - void PropertyModified(IProperty* pProperty); - void ModifyTintColor(CColor& Color); + void PropertyModified(IProperty* pProperty) override; + void ModifyTintColor(CColor& Color) override; CScan* GetScan() const { return mpScanData; } static const CColor skRegularColor; diff --git a/src/Core/ScriptExtra/CRadiusSphereExtra.h b/src/Core/ScriptExtra/CRadiusSphereExtra.h index e7c41384..1b48cf69 100644 --- a/src/Core/ScriptExtra/CRadiusSphereExtra.h +++ b/src/Core/ScriptExtra/CRadiusSphereExtra.h @@ -10,9 +10,9 @@ class CRadiusSphereExtra : public CScriptExtra CFloatRef mRadius; public: - explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0); - void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo); - void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo); + explicit CRadiusSphereExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr); + void AddToRenderer(CRenderer* pRenderer, const SViewInfo& rkViewInfo) override; + void Draw(FRenderOptions Options, int ComponentIndex, ERenderCommand Command, const SViewInfo& rkViewInfo) override; CColor Color() const; CAABox Bounds() const; }; diff --git a/src/Core/ScriptExtra/CScriptExtra.h b/src/Core/ScriptExtra/CScriptExtra.h index d2d91dd4..12582f6a 100644 --- a/src/Core/ScriptExtra/CScriptExtra.h +++ b/src/Core/ScriptExtra/CScriptExtra.h @@ -26,7 +26,7 @@ protected: EGame mGame; public: - explicit CScriptExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0) + explicit CScriptExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr) : CSceneNode(pScene, -1, pParent) , mpScriptNode(pParent) , mpInstance(pInstance) @@ -34,20 +34,20 @@ public: { } - virtual ~CScriptExtra() {} - inline CScriptObject* Instance() const { return mpInstance; } - inline EGame Game() const { return mGame; } + virtual ~CScriptExtra() = default; + CScriptObject* Instance() const { return mpInstance; } + EGame Game() const { return mGame; } // Default implementations for CSceneNode - virtual ENodeType NodeType() { return ENodeType::ScriptExtra; } - virtual void RayAABoxIntersectTest(CRayCollisionTester& /*rTester*/, const SViewInfo& /*rkViewInfo*/) {} - virtual SRayIntersection RayNodeIntersectTest(const CRay& /*rkRay*/, uint32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/) + ENodeType NodeType() override { return ENodeType::ScriptExtra; } + void RayAABoxIntersectTest(CRayCollisionTester& /*rTester*/, const SViewInfo& /*rkViewInfo*/) override {} + SRayIntersection RayNodeIntersectTest(const CRay& /*rkRay*/, uint32 /*AssetID*/, const SViewInfo& /*rkViewInfo*/) override { SRayIntersection out; out.Hit = false; return out; } - virtual CColor WireframeColor() const { return mpParent->WireframeColor(); } + CColor WireframeColor() const override { return mpParent->WireframeColor(); } // Virtual CScriptExtra functions virtual void InstanceTransformed() {} diff --git a/src/Core/ScriptExtra/CSpacePirateExtra.h b/src/Core/ScriptExtra/CSpacePirateExtra.h index 06c116fd..a6204ea5 100644 --- a/src/Core/ScriptExtra/CSpacePirateExtra.h +++ b/src/Core/ScriptExtra/CSpacePirateExtra.h @@ -25,8 +25,8 @@ class CSpacePirateExtra : public CScriptExtra TEnumRef mPlasmaVulnerability; public: - explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0); - CColor TevColor(); + explicit CSpacePirateExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr); + CColor TevColor() override; }; #endif // CSPACEPIRATEEXTRA_H diff --git a/src/Core/ScriptExtra/CSplinePathExtra.h b/src/Core/ScriptExtra/CSplinePathExtra.h index 58172d56..c4606f7b 100644 --- a/src/Core/ScriptExtra/CSplinePathExtra.h +++ b/src/Core/ScriptExtra/CSplinePathExtra.h @@ -15,12 +15,12 @@ class CSplinePathExtra : public CScriptExtra std::list mWaypoints; public: - explicit CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = 0); - ~CSplinePathExtra() { ClearWaypoints(); } - inline CColor PathColor() const { return (mPathColor.IsValid() ? mPathColor.Get() : CColor::skBlack); } + explicit CSplinePathExtra(CScriptObject* pInstance, CScene* pScene, CScriptNode* pParent = nullptr); + ~CSplinePathExtra() override { ClearWaypoints(); } + CColor PathColor() const { return mPathColor.IsValid() ? mPathColor.Get() : CColor::skBlack; } - void PostLoad(); - void PropertyModified(IProperty* pProperty); + void PostLoad() override; + void PropertyModified(IProperty* pProperty) override; void FindAttachedWaypoints(std::set& rChecked, CWaypointExtra* pWaypoint); void AddWaypoints(); diff --git a/src/Core/ScriptExtra/CWaypointExtra.cpp b/src/Core/ScriptExtra/CWaypointExtra.cpp index a7ba7d21..7dfa62f0 100644 --- a/src/Core/ScriptExtra/CWaypointExtra.cpp +++ b/src/Core/ScriptExtra/CWaypointExtra.cpp @@ -6,8 +6,6 @@ CWaypointExtra::CWaypointExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent) : CScriptExtra(pInstance, pScene, pParent) - , mColor(CColor::skBlack) - , mLinksBuilt(false) { CheckColor(); } diff --git a/src/Core/ScriptExtra/CWaypointExtra.h b/src/Core/ScriptExtra/CWaypointExtra.h index 89e5550d..b3aecd3c 100644 --- a/src/Core/ScriptExtra/CWaypointExtra.h +++ b/src/Core/ScriptExtra/CWaypointExtra.h @@ -8,8 +8,8 @@ class CWaypointExtra : public CScriptExtra { // Draw waypoint paths formed by script connections - CColor mColor; - bool mLinksBuilt; + CColor mColor{CColor::skBlack}; + bool mLinksBuilt = false; std::list mPaths; struct SWaypointLink @@ -20,7 +20,7 @@ class CWaypointExtra : public CScriptExtra std::vector mLinks; public: - explicit CWaypointExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = 0); + explicit CWaypointExtra(CScriptObject *pInstance, CScene *pScene, CScriptNode *pParent = nullptr); ~CWaypointExtra(); void CheckColor(); void AddToSplinePath(CSplinePathExtra *pPath); diff --git a/src/Core/Tweaks/CTweakCooker.h b/src/Core/Tweaks/CTweakCooker.h index 06232f19..7cf23d57 100644 --- a/src/Core/Tweaks/CTweakCooker.h +++ b/src/Core/Tweaks/CTweakCooker.h @@ -7,7 +7,7 @@ class CTweakCooker { /** Private constructor */ - CTweakCooker() {} + CTweakCooker() = default; public: /** Cooker entry point */ diff --git a/src/Core/Tweaks/CTweakData.h b/src/Core/Tweaks/CTweakData.h index 63c588dd..f43a68bf 100644 --- a/src/Core/Tweaks/CTweakData.h +++ b/src/Core/Tweaks/CTweakData.h @@ -43,17 +43,17 @@ public: } } - inline CScriptTemplate* TweakTemplate() const + CScriptTemplate* TweakTemplate() const { return mpTemplate; } - inline uint32 TweakID() const + uint32 TweakID() const { return mTweakID; } - inline CStructRef TweakData() const + CStructRef TweakData() const { return CStructRef((void*) mTweakData.data(), mpTemplate->Properties()); } diff --git a/src/Core/Tweaks/CTweakLoader.h b/src/Core/Tweaks/CTweakLoader.h index 4467449f..0f6671b1 100644 --- a/src/Core/Tweaks/CTweakLoader.h +++ b/src/Core/Tweaks/CTweakLoader.h @@ -7,7 +7,7 @@ class CTweakLoader { /** Private constructor */ - CTweakLoader() {} + CTweakLoader() = default; public: /** Loader entry point */ diff --git a/src/Core/Tweaks/CTweakManager.h b/src/Core/Tweaks/CTweakManager.h index 2ee24afb..6d9fd9f5 100644 --- a/src/Core/Tweaks/CTweakManager.h +++ b/src/Core/Tweaks/CTweakManager.h @@ -16,7 +16,7 @@ class CTweakManager TString mStandardFilePath; public: - CTweakManager(CGameProject* pInProject); + explicit CTweakManager(CGameProject* pInProject); ~CTweakManager(); void LoadTweaks(); bool SaveTweaks();