From 478ae3d9966f25f389318dceb6d90a9132f34c0b Mon Sep 17 00:00:00 2001 From: gsemaj Date: Sun, 13 Aug 2023 14:26:05 -0700 Subject: [PATCH] Break if player dies from buff combat tick --- src/Combat.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Combat.cpp b/src/Combat.cpp index 4b1f224..7a46cfa 100644 --- a/src/Combat.cpp +++ b/src/Combat.cpp @@ -169,6 +169,8 @@ void Player::step(time_t currTime) { // buffs for(auto buffEntry : buffs) { buffEntry.second->combatTick(currTime); + if(!isAlive()) + break; // unsafe to keep ticking if we're dead } } #pragma endregion @@ -957,6 +959,7 @@ static void playerTick(CNServer *serv, time_t currTime) { auto it = plr->buffs.begin(); while(it != plr->buffs.end()) { Buff* buff = (*it).second; + //buff->combatTick() gets called in Player::step buff->tick(currTime); if(buff->isStale()) { // garbage collect