Use of final

This commit is contained in:
David Markowitz 2023-06-26 01:23:22 -07:00
parent a5611e9c7f
commit 06acd23cb7
6 changed files with 10 additions and 21 deletions

View File

@ -6,7 +6,7 @@
class Entity; class Entity;
class AchievementVendorComponent : public VendorComponent { class AchievementVendorComponent final : public VendorComponent {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::ACHIEVEMENT_VENDOR; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::ACHIEVEMENT_VENDOR;
AchievementVendorComponent(Entity* parent); AchievementVendorComponent(Entity* parent);

View File

@ -51,7 +51,7 @@ struct AiSkillEntry {
/** /**
* Handles the AI of entities, making them wander, tether and attack their enemies * Handles the AI of entities, making them wander, tether and attack their enemies
*/ */
class BaseCombatAIComponent : public Component { class BaseCombatAIComponent final : public Component {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BASE_COMBAT_AI;

View File

@ -46,7 +46,6 @@ void BouncerComponent::SetBouncerEnabled(bool value) {
m_ParentEntity->TriggerEvent(eTriggerEventType::PET_OFF_SWITCH, m_ParentEntity); m_ParentEntity->TriggerEvent(eTriggerEventType::PET_OFF_SWITCH, m_ParentEntity);
GameMessages::SendStopFXEffect(m_ParentEntity, true, "PetOnSwitch"); GameMessages::SendStopFXEffect(m_ParentEntity, true, "PetOnSwitch");
} }
} }
void BouncerComponent::LookupPetSwitch() { void BouncerComponent::LookupPetSwitch() {

View File

@ -10,7 +10,7 @@
/** /**
* Attached to bouncer entities, allowing other entities to bounce off of it * Attached to bouncer entities, allowing other entities to bounce off of it
*/ */
class BouncerComponent : public Component { class BouncerComponent final : public Component {
public: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BOUNCER;

View File

@ -14,12 +14,6 @@
std::unordered_map<int32_t, std::vector<BuffParameter>> BuffComponent::m_Cache{}; std::unordered_map<int32_t, std::vector<BuffParameter>> BuffComponent::m_Cache{};
BuffComponent::BuffComponent(Entity* parent) : Component(parent) {
}
BuffComponent::~BuffComponent() {
}
void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
if (!bIsInitialUpdate) return; if (!bIsInitialUpdate) return;
if (m_Buffs.empty()) { if (m_Buffs.empty()) {

View File

@ -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 * 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 struct BuffParameter {
{ int32_t buffId = 0;
int32_t buffId;
std::string name; std::string name;
float value; float value = 0.0f;
std::vector<float> values; std::vector<float> 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. * 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; int32_t id = 0;
float time = 0; float time = 0;
float tick = 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. * 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: public:
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUFF; inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUFF;
explicit BuffComponent(Entity* parent); explicit BuffComponent(Entity* parent) : Component(parent) { };
~BuffComponent();
Entity* GetParentEntity() const; Entity* GetParentEntity() const;