aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Deutscher <adeutscher@gmail.com>2020-01-14 10:49:32 -0800
committerGiacomo Pozzoni <giacomopoz@gmail.com>2020-01-14 19:49:32 +0100
commita0c07655eb6b42a2e1fd9319d53c7ed7f2c585d8 (patch)
tree49a46c5d420cf8b0019908d1d1867f316b348985 /src
parentd4ba47a76e71a0ac103a1ff9b892593bc9c6a67a (diff)
Scripts/Spells: fix Turkey Timer duration (#24048)
* spell_gen_turkey_marker::OnPeriodic: Pop expired stack timestamps from tracking list. * Be a bit more explicit about the data type of removedCount. * Formatting nudge. * Remove brackets.
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 3bc572af964..ce4c520cf81 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3463,12 +3463,17 @@ class spell_gen_turkey_marker : public AuraScript
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
- if (_applyTimes.empty())
- return;
+ int32 removeCount = 0;
+
+ // pop expired times off of the stack
+ while (!_applyTimes.empty() && _applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS())
+ {
+ _applyTimes.pop_front();
+ removeCount++;
+ }
- // pop stack if it expired for us
- if (_applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS())
- ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE);
+ if (removeCount)
+ ModStackAmount(-removeCount, AURA_REMOVE_BY_EXPIRE);
}
void Register() override