From 598d88b3071bcc39bf8b5185288ff2a5004971c0 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sun, 9 Jul 2023 22:20:51 -0700 Subject: [PATCH] PlayerForcedMovementComponent pass --- .../PlayerForcedMovementComponent.cpp | 8 ++---- .../PlayerForcedMovementComponent.h | 28 ++++++++----------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/dGame/dComponents/PlayerForcedMovementComponent.cpp b/dGame/dComponents/PlayerForcedMovementComponent.cpp index bb5005bf..d92af485 100644 --- a/dGame/dComponents/PlayerForcedMovementComponent.cpp +++ b/dGame/dComponents/PlayerForcedMovementComponent.cpp @@ -1,16 +1,12 @@ #include "PlayerForcedMovementComponent.h" -PlayerForcedMovementComponent::PlayerForcedMovementComponent(Entity* parent) : Component(parent) { - m_ParentEntity = parent; -} - -PlayerForcedMovementComponent::~PlayerForcedMovementComponent() {} +#include "BitStream.h" void PlayerForcedMovementComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { outBitStream->Write(m_DirtyInfo || bIsInitialUpdate); if (m_DirtyInfo || bIsInitialUpdate) { outBitStream->Write(m_PlayerOnRail); outBitStream->Write(m_ShowBillboard); + if (!bIsInitialUpdate) m_DirtyInfo = false; } - m_DirtyInfo = false; } diff --git a/dGame/dComponents/PlayerForcedMovementComponent.h b/dGame/dComponents/PlayerForcedMovementComponent.h index 5e036520..b67c3f2d 100644 --- a/dGame/dComponents/PlayerForcedMovementComponent.h +++ b/dGame/dComponents/PlayerForcedMovementComponent.h @@ -16,8 +16,7 @@ public: * Constructor for this component * @param parent parent that contains this component */ - PlayerForcedMovementComponent(Entity* parent); - ~PlayerForcedMovementComponent() override; + PlayerForcedMovementComponent(Entity* parent) : Component(parent) {}; void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags); @@ -26,28 +25,23 @@ public: * * @param value if the player is on a rail */ - void SetPlayerOnRail(bool value) { m_PlayerOnRail = value; m_DirtyInfo = true; } + void SetPlayerOnRail(bool value) { + if (m_PlayerOnRail == value) return; + m_PlayerOnRail = value; + m_DirtyInfo = true; + } /** * @brief Set the Show Billboard object * * @param value if the billboard should be shown */ - void SetShowBillboard(bool value) { m_ShowBillboard = value; m_DirtyInfo = true; } + void SetShowBillboard(bool value) { + if (m_ShowBillboard == value) return; + m_ShowBillboard = value; + m_DirtyInfo = true; + } - /** - * @brief Get the Player On Rail object - * - * @return true - * @return false - */ - - /** - * @brief Get the Player On Rail object - * - * @return true - * @return false - */ bool GetPlayerOnRail() { return m_PlayerOnRail; } bool GetShowBillboard() { return m_ShowBillboard; }