mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Implement a new event to receive notifications when a checkpoint radius has changed.
This commit is contained in:
@ -294,8 +294,18 @@ void CCheckpoint::SetRadius(Float32 radius) const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
// Grab the current value for this property
|
||||
const Float32 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))
|
||||
{
|
||||
// Prevent this event from triggering while executed
|
||||
BitGuardU32 bg(m_CircularLocks, CHECKPOINTCL_EMIT_CHECKPOINT_RADIUS);
|
||||
// Now forward the event call
|
||||
Core::Get().EmitCheckpointRadius(m_ID, current, radius);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -12,7 +12,8 @@ namespace SqMod {
|
||||
*/
|
||||
enum CheckpointCircularLocks
|
||||
{
|
||||
CHECKPOINTCL_EMIT_CHECKPOINT_WORLD = (1 << 0)
|
||||
CHECKPOINTCL_EMIT_CHECKPOINT_WORLD = (1 << 0),
|
||||
CHECKPOINTCL_EMIT_CHECKPOINT_RADIUS = (2 << 0)
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@ -255,7 +256,7 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the radius of the managed checkpoint entity.
|
||||
*/
|
||||
void SetRadius(Float32 radius) const;
|
||||
void SetRadius(Float32 radius);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the owner of the managed checkpoint entity.
|
||||
|
Reference in New Issue
Block a user