Break if player dies from buff combat tick

This commit is contained in:
gsemaj 2023-08-13 14:26:05 -07:00 committed by gsemaj
parent 36b6aeeb00
commit b04c292272

View File

@ -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