local work

This commit is contained in:
David Markowitz 2023-07-11 00:26:27 -07:00
parent 949a6db4bc
commit 6240eefc7e
3 changed files with 9 additions and 18 deletions

View File

@ -45,23 +45,20 @@ RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component
RenderComponent::~RenderComponent() { RenderComponent::~RenderComponent() {
for (Effect* eff : m_Effects) { for (Effect* eff : m_Effects) {
if (eff) { if (!eff) continue;
delete eff; delete eff;
eff = nullptr; eff = nullptr;
} }
} }
m_Effects.clear();
}
void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
if (!bIsInitialUpdate) return; if (!bIsInitialUpdate) return;
outBitStream->Write<uint32_t>(m_Effects.size()); outBitStream->Write<uint32_t>(m_Effects.size());
for (Effect* eff : m_Effects) { for (auto* eff : m_Effects) {
// Check that the effect is non-null // Check that the effect is non-null
assert(eff); DluAssert(eff);
outBitStream->Write<uint8_t>(eff->name.size()); outBitStream->Write<uint8_t>(eff->name.size());
for (const auto& value : eff->name) for (const auto& value : eff->name)
@ -189,7 +186,6 @@ std::vector<Effect*>& RenderComponent::GetEffects() {
return m_Effects; return m_Effects;
} }
float RenderComponent::PlayAnimation(Entity* self, const std::u16string& animation, float priority, float scale) { float RenderComponent::PlayAnimation(Entity* self, const std::u16string& animation, float priority, float scale) {
if (!self) return 0.0f; if (!self) return 0.0f;
return RenderComponent::PlayAnimation(self, GeneralUtils::UTF16ToWTF8(animation), priority, scale); 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); return RenderComponent::DoAnimation(self, animation, false);
} }
float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) { float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) {
float returnlength = 0.0f; float returnlength = 0.0f;
if (!self) return returnlength; if (!self) return returnlength;

View File

@ -12,9 +12,6 @@ RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* paren
m_IsDirty = true; m_IsDirty = true;
} }
RigidbodyPhantomPhysicsComponent::~RigidbodyPhantomPhysicsComponent() {
}
void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
outBitStream->Write(m_IsDirty || bIsInitialUpdate); outBitStream->Write(m_IsDirty || bIsInitialUpdate);
if (m_IsDirty || bIsInitialUpdate) { if (m_IsDirty || bIsInitialUpdate) {

View File

@ -3,8 +3,8 @@
* Copyright 2019 * Copyright 2019
*/ */
#ifndef RIGIDBODYPHANTOMPHYSICS_H #ifndef __RIGIDBODYPHANTOMPHYSICS_H__
#define RIGIDBODYPHANTOMPHYSICS_H #define __RIGIDBODYPHANTOMPHYSICS_H__
#include "BitStream.h" #include "BitStream.h"
#include "dCommonVars.h" #include "dCommonVars.h"
@ -22,7 +22,6 @@ public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
RigidbodyPhantomPhysicsComponent(Entity* parent); RigidbodyPhantomPhysicsComponent(Entity* parent);
~RigidbodyPhantomPhysicsComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags); void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
@ -68,4 +67,4 @@ private:
bool m_IsDirty; bool m_IsDirty;
}; };
#endif // RIGIDBODYPHANTOMPHYSICS_H #endif // __RIGIDBODYPHANTOMPHYSICS_H__