From e60e2958f006945b0ad77b34978f3df4d3fd33a5 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sun, 12 Sep 2021 16:02:46 +0300 Subject: [PATCH] Change the order of custom Checkpoint events to happen before performing the action. --- module/Entity/Checkpoint.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/Entity/Checkpoint.cpp b/module/Entity/Checkpoint.cpp index 57066b5f..70617a13 100644 --- a/module/Entity/Checkpoint.cpp +++ b/module/Entity/Checkpoint.cpp @@ -157,16 +157,16 @@ void CCheckpoint::SetWorld(int32_t world) { return; } - // Avoid property unwind from a recursive call - _Func->SetCheckPointWorld(m_ID, world); // Avoid infinite recursive event loops - if (!(m_CircularLocks & CHECKPOINTCL_EMIT_CHECKPOINT_WORLD)) + else if (!(m_CircularLocks & CHECKPOINTCL_EMIT_CHECKPOINT_WORLD)) { // Prevent this event from triggering while executed BitGuardU32 bg(m_CircularLocks, CHECKPOINTCL_EMIT_CHECKPOINT_WORLD); // Now forward the event call Core::Get().EmitCheckpointWorld(m_ID, current, world); } + // Avoid property unwind from a recursive call + _Func->SetCheckPointWorld(m_ID, world); } // ------------------------------------------------------------------------------------------------ @@ -257,8 +257,6 @@ void CCheckpoint::SetRadius(float radius) Validate(); // Grab the current value for this property const float current = _Func->GetCheckPointRadius(m_ID); - // Avoid property unwind from a recursive call - _Func->SetCheckPointRadius(m_ID, radius); // Avoid infinite recursive event loops if (!(m_CircularLocks & CHECKPOINTCL_EMIT_CHECKPOINT_RADIUS)) { @@ -267,6 +265,8 @@ void CCheckpoint::SetRadius(float radius) // Now forward the event call Core::Get().EmitCheckpointRadius(m_ID, current, radius); } + // Avoid property unwind from a recursive call + _Func->SetCheckPointRadius(m_ID, radius); } // ------------------------------------------------------------------------------------------------