From 6240eefc7e6e33db8771f30fbcd18f324720f8bc Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 11 Jul 2023 00:26:27 -0700 Subject: [PATCH] local work --- dGame/dComponents/RenderComponent.cpp | 17 ++++++----------- .../RigidbodyPhantomPhysicsComponent.cpp | 3 --- .../RigidbodyPhantomPhysicsComponent.h | 7 +++---- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/dGame/dComponents/RenderComponent.cpp b/dGame/dComponents/RenderComponent.cpp index 7c21e80e..2c09c621 100644 --- a/dGame/dComponents/RenderComponent.cpp +++ b/dGame/dComponents/RenderComponent.cpp @@ -15,7 +15,7 @@ std::unordered_map RenderComponent::m_DurationCache{}; -RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component(parent) { +RenderComponent::RenderComponent(Entity* parent, int32_t componentId) : Component(parent) { m_Effects = std::vector(); m_LastAnimationName = ""; if (componentId == -1) return; @@ -45,13 +45,10 @@ RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component RenderComponent::~RenderComponent() { for (Effect* eff : m_Effects) { - if (eff) { - delete eff; - eff = nullptr; - } + if (!eff) continue; + delete eff; + eff = nullptr; } - - m_Effects.clear(); } void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { @@ -59,9 +56,9 @@ void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitial outBitStream->Write(m_Effects.size()); - for (Effect* eff : m_Effects) { + for (auto* eff : m_Effects) { // Check that the effect is non-null - assert(eff); + DluAssert(eff); outBitStream->Write(eff->name.size()); for (const auto& value : eff->name) @@ -189,7 +186,6 @@ std::vector& RenderComponent::GetEffects() { return m_Effects; } - float RenderComponent::PlayAnimation(Entity* self, const std::u16string& animation, float priority, float scale) { if (!self) return 0.0f; return RenderComponent::PlayAnimation(self, GeneralUtils::UTF16ToWTF8(animation), priority, scale); @@ -210,7 +206,6 @@ float RenderComponent::GetAnimationTime(Entity* self, const std::string& animati return RenderComponent::DoAnimation(self, animation, false); } - float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) { float returnlength = 0.0f; if (!self) return returnlength; diff --git a/dGame/dComponents/RigidbodyPhantomPhysicsComponent.cpp b/dGame/dComponents/RigidbodyPhantomPhysicsComponent.cpp index 5c497d8d..39ee78f4 100644 --- a/dGame/dComponents/RigidbodyPhantomPhysicsComponent.cpp +++ b/dGame/dComponents/RigidbodyPhantomPhysicsComponent.cpp @@ -12,9 +12,6 @@ RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* paren m_IsDirty = true; } -RigidbodyPhantomPhysicsComponent::~RigidbodyPhantomPhysicsComponent() { -} - void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { outBitStream->Write(m_IsDirty || bIsInitialUpdate); if (m_IsDirty || bIsInitialUpdate) { diff --git a/dGame/dComponents/RigidbodyPhantomPhysicsComponent.h b/dGame/dComponents/RigidbodyPhantomPhysicsComponent.h index 718f02a7..a1d02092 100644 --- a/dGame/dComponents/RigidbodyPhantomPhysicsComponent.h +++ b/dGame/dComponents/RigidbodyPhantomPhysicsComponent.h @@ -3,8 +3,8 @@ * Copyright 2019 */ -#ifndef RIGIDBODYPHANTOMPHYSICS_H -#define RIGIDBODYPHANTOMPHYSICS_H +#ifndef __RIGIDBODYPHANTOMPHYSICS_H__ +#define __RIGIDBODYPHANTOMPHYSICS_H__ #include "BitStream.h" #include "dCommonVars.h" @@ -22,7 +22,6 @@ public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS; RigidbodyPhantomPhysicsComponent(Entity* parent); - ~RigidbodyPhantomPhysicsComponent() override; void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags); @@ -68,4 +67,4 @@ private: bool m_IsDirty; }; -#endif // RIGIDBODYPHANTOMPHYSICS_H +#endif // __RIGIDBODYPHANTOMPHYSICS_H__