From 93ec6380c1caf3a7b909736964ff0df8e7f3362d Mon Sep 17 00:00:00 2001 From: gsemaj Date: Sun, 13 Aug 2023 10:50:50 -0700 Subject: [PATCH] Tighten parameter for removeBuff --- src/Combat.cpp | 8 ++++---- src/Entities.hpp | 4 ++-- src/Player.hpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Combat.cpp b/src/Combat.cpp index 8b96845..4b1f224 100644 --- a/src/Combat.cpp +++ b/src/Combat.cpp @@ -49,9 +49,9 @@ void Player::removeBuff(int buffId) { } } -void Player::removeBuff(int buffId, int buffClass) { +void Player::removeBuff(int buffId, BuffClass buffClass) { if(hasBuff(buffId)) { - buffs[buffId]->clear((BuffClass)buffClass); + buffs[buffId]->clear(buffClass); // buff might not be stale since another buff class might remain if(buffs[buffId]->isStale()) { delete buffs[buffId]; @@ -203,9 +203,9 @@ void CombatNPC::removeBuff(int buffId) { } } -void CombatNPC::removeBuff(int buffId, int buffClass) { +void CombatNPC::removeBuff(int buffId, BuffClass buffClass) { if(hasBuff(buffId)) { - buffs[buffId]->clear((BuffClass)buffClass); + buffs[buffId]->clear(buffClass); // buff might not be stale since another buff class might remain if(buffs[buffId]->isStale()) { delete buffs[buffId]; diff --git a/src/Entities.hpp b/src/Entities.hpp index 9dffe5d..2867801 100644 --- a/src/Entities.hpp +++ b/src/Entities.hpp @@ -47,7 +47,7 @@ public: virtual bool addBuff(int, BuffCallback, BuffCallback, BuffStack*) = 0; virtual Buff* getBuff(int) = 0; virtual void removeBuff(int) = 0; - virtual void removeBuff(int, int) = 0; + virtual void removeBuff(int, BuffClass) = 0; virtual void clearBuffs(bool) = 0; virtual bool hasBuff(int) = 0; virtual int getCompositeCondition() = 0; @@ -125,7 +125,7 @@ struct CombatNPC : public BaseNPC, public ICombatant { virtual bool addBuff(int buffId, BuffCallback onUpdate, BuffCallback onTick, BuffStack* stack) override; virtual Buff* getBuff(int buffId) override; virtual void removeBuff(int buffId) override; - virtual void removeBuff(int buffId, int buffClass) override; + virtual void removeBuff(int buffId, BuffClass buffClass) override; virtual void clearBuffs(bool force) override; virtual bool hasBuff(int buffId) override; virtual int getCompositeCondition() override; diff --git a/src/Player.hpp b/src/Player.hpp index 5ca112c..14019ab 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -92,7 +92,7 @@ struct Player : public Entity, public ICombatant { virtual bool addBuff(int buffId, BuffCallback onUpdate, BuffCallback onTick, BuffStack* stack) override; virtual Buff* getBuff(int buffId) override; virtual void removeBuff(int buffId) override; - virtual void removeBuff(int buffId, int buffClass) override; + virtual void removeBuff(int buffId, BuffClass buffClass) override; virtual void clearBuffs(bool force) override; virtual bool hasBuff(int buffId) override; virtual int getCompositeCondition() override;