summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Entities/Pawn.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp
index b7fab31c3..0a9abcdc1 100644
--- a/src/Entities/Pawn.cpp
+++ b/src/Entities/Pawn.cpp
@@ -57,9 +57,6 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
cEntityEffect::eType EffectType = iter->first;
cEntityEffect * Effect = iter->second;
- // Call OnTick later to make sure the iterator won't be invalid
- EffectsToTick.push_back(Effect);
-
// Iterates (must be called before any possible erasure)
++iter;
@@ -68,6 +65,11 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
RemoveEntityEffect(EffectType);
}
+ // Call OnTick later to make sure the iterator won't be invalid
+ else
+ {
+ EffectsToTick.push_back(Effect);
+ }
// TODO: Check for discrepancies between client and server effect values
}