buffRemoval (#1464)

Update BuffComponent.cpp
This commit is contained in:
David Markowitz 2024-02-24 23:01:28 -08:00 committed by GitHub
parent 721ea78bb4
commit 1328850a8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View File

@ -208,9 +208,8 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity, bool ignoreRefCount) {
const auto& iter = m_Buffs.find(id);
if (iter == m_Buffs.end()) {
return;
}
// If the buff is already scheduled to be removed, don't do it again
if (iter == m_Buffs.end() || m_BuffsToRemove.contains(id)) return;
if (!ignoreRefCount && !iter->second.cancelOnRemoveBuff) {
iter->second.refCount--;
@ -222,7 +221,7 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
m_BuffsToRemove.push_back(id);
m_BuffsToRemove.insert(id);
RemoveBuffEffect(id);
}

View File

@ -141,7 +141,7 @@ private:
std::map<int32_t, Buff> m_Buffs;
// Buffs to remove at the end of the update frame.
std::vector<int32_t> m_BuffsToRemove;
std::set<int32_t> m_BuffsToRemove;
/**
* Parameters (=effects) for each buff