parent
90fcf9814f
commit
4170ab62c0
@ -48,6 +48,8 @@ void cPawn::Destroyed()
|
|||||||
|
|
||||||
void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||||
{
|
{
|
||||||
|
std::vector<cEntityEffect *> EffectsToTick;
|
||||||
|
|
||||||
// Iterate through this entity's applied effects
|
// Iterate through this entity's applied effects
|
||||||
for (tEffectMap::iterator iter = m_EntityEffects.begin(); iter != m_EntityEffects.end();)
|
for (tEffectMap::iterator iter = m_EntityEffects.begin(); iter != m_EntityEffects.end();)
|
||||||
{
|
{
|
||||||
@ -55,7 +57,8 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|||||||
cEntityEffect::eType EffectType = iter->first;
|
cEntityEffect::eType EffectType = iter->first;
|
||||||
cEntityEffect * Effect = iter->second;
|
cEntityEffect * Effect = iter->second;
|
||||||
|
|
||||||
Effect->OnTick(*this);
|
// Call OnTick later to make sure the iterator won't be invalid
|
||||||
|
EffectsToTick.push_back(Effect);
|
||||||
|
|
||||||
// Iterates (must be called before any possible erasure)
|
// Iterates (must be called before any possible erasure)
|
||||||
++iter;
|
++iter;
|
||||||
@ -69,6 +72,12 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|||||||
// TODO: Check for discrepancies between client and server effect values
|
// TODO: Check for discrepancies between client and server effect values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (auto * Effect : EffectsToTick)
|
||||||
|
{
|
||||||
|
Effect->OnTick(*this);
|
||||||
|
}
|
||||||
|
|
||||||
class Pusher : public cEntityCallback
|
class Pusher : public cEntityCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user