From 06acd23cb74b1eab48c60cf1e48f4c912935503a Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Mon, 26 Jun 2023 01:23:22 -0700 Subject: [PATCH] Use of final --- dGame/dComponents/AchievementVendorComponent.h | 2 +- dGame/dComponents/BaseCombatAIComponent.h | 2 +- dGame/dComponents/BouncerComponent.cpp | 1 - dGame/dComponents/BouncerComponent.h | 2 +- dGame/dComponents/BuffComponent.cpp | 6 ------ dGame/dComponents/BuffComponent.h | 18 +++++++----------- 6 files changed, 10 insertions(+), 21 deletions(-) diff --git a/dGame/dComponents/AchievementVendorComponent.h b/dGame/dComponents/AchievementVendorComponent.h index 62fb87bd..cfd42a66 100644 --- a/dGame/dComponents/AchievementVendorComponent.h +++ b/dGame/dComponents/AchievementVendorComponent.h @@ -6,7 +6,7 @@ class Entity; -class AchievementVendorComponent : public VendorComponent { +class AchievementVendorComponent final : public VendorComponent { public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::ACHIEVEMENT_VENDOR; AchievementVendorComponent(Entity* parent); diff --git a/dGame/dComponents/BaseCombatAIComponent.h b/dGame/dComponents/BaseCombatAIComponent.h index 78116b9d..ed883ebd 100644 --- a/dGame/dComponents/BaseCombatAIComponent.h +++ b/dGame/dComponents/BaseCombatAIComponent.h @@ -51,7 +51,7 @@ struct AiSkillEntry { /** * Handles the AI of entities, making them wander, tether and attack their enemies */ -class BaseCombatAIComponent : public Component { +class BaseCombatAIComponent final : public Component { public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI; diff --git a/dGame/dComponents/BouncerComponent.cpp b/dGame/dComponents/BouncerComponent.cpp index df4921e4..4ed6df78 100644 --- a/dGame/dComponents/BouncerComponent.cpp +++ b/dGame/dComponents/BouncerComponent.cpp @@ -46,7 +46,6 @@ void BouncerComponent::SetBouncerEnabled(bool value) { m_ParentEntity->TriggerEvent(eTriggerEventType::PET_OFF_SWITCH, m_ParentEntity); GameMessages::SendStopFXEffect(m_ParentEntity, true, "PetOnSwitch"); } - } void BouncerComponent::LookupPetSwitch() { diff --git a/dGame/dComponents/BouncerComponent.h b/dGame/dComponents/BouncerComponent.h index 6005cc3b..cce65eb4 100644 --- a/dGame/dComponents/BouncerComponent.h +++ b/dGame/dComponents/BouncerComponent.h @@ -10,7 +10,7 @@ /** * Attached to bouncer entities, allowing other entities to bounce off of it */ -class BouncerComponent : public Component { +class BouncerComponent final : public Component { public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER; diff --git a/dGame/dComponents/BuffComponent.cpp b/dGame/dComponents/BuffComponent.cpp index 9f40fe0e..92b33efb 100644 --- a/dGame/dComponents/BuffComponent.cpp +++ b/dGame/dComponents/BuffComponent.cpp @@ -14,12 +14,6 @@ std::unordered_map> BuffComponent::m_Cache{}; -BuffComponent::BuffComponent(Entity* parent) : Component(parent) { -} - -BuffComponent::~BuffComponent() { -} - void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { if (!bIsInitialUpdate) return; if (m_Buffs.empty()) { diff --git a/dGame/dComponents/BuffComponent.h b/dGame/dComponents/BuffComponent.h index bbd8d785..5c4bd168 100644 --- a/dGame/dComponents/BuffComponent.h +++ b/dGame/dComponents/BuffComponent.h @@ -14,20 +14,18 @@ class Entity; /** * Extra information on effects to apply after applying a buff, for example whether to buff armor, imag or health and by how much */ -struct BuffParameter -{ - int32_t buffId; +struct BuffParameter { + int32_t buffId = 0; std::string name; - float value; + float value = 0.0f; std::vector values; - int32_t effectId; + int32_t effectId = 0; }; /** * Meta information about a buff that can be applied, e.g. how long it's applied, who applied it, etc. */ -struct Buff -{ +struct Buff { int32_t id = 0; float time = 0; float tick = 0; @@ -40,13 +38,11 @@ struct Buff /** * Allows for the application of buffs to the parent entity, altering health, armor and imagination. */ -class BuffComponent : public Component { +class BuffComponent final : public Component { public: inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUFF; - explicit BuffComponent(Entity* parent); - - ~BuffComponent(); + explicit BuffComponent(Entity* parent) : Component(parent) { }; Entity* GetParentEntity() const;