mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-26 15:00:06 +00:00
Fix timed out buffs not calling onExpire
This commit is contained in:
parent
ad9bf2a9e3
commit
0e054e21b6
@ -12,8 +12,12 @@ void Buff::tick() {
|
|||||||
|
|
||||||
if(stack.durationTicks > 0) stack.durationTicks--;
|
if(stack.durationTicks > 0) stack.durationTicks--;
|
||||||
if(stack.durationTicks == 0) {
|
if(stack.durationTicks == 0) {
|
||||||
|
// erase() destroys the callbacks
|
||||||
|
// with the stack struct, so we need
|
||||||
|
// to copy it first.
|
||||||
|
BuffStack deadStack = stack;
|
||||||
it = stacks.erase(it);
|
it = stacks.erase(it);
|
||||||
if(stack.onExpire) stack.onExpire(self, &stack);
|
if(deadStack.onExpire) deadStack.onExpire(self, &deadStack);
|
||||||
} else it++;
|
} else it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user