1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-06 08:57:11 +02:00

Implement a new event to receive notifications when an pickup auto timer has changed.

This commit is contained in:
Sandu Liviu Catalin
2016-08-19 18:26:52 +03:00
parent a47f7541d0
commit e179452a61
6 changed files with 36 additions and 4 deletions

View File

@ -266,12 +266,27 @@ Int32 CPickup::GetAutoTimer() const
}
// ------------------------------------------------------------------------------------------------
void CPickup::SetAutoTimer(Int32 timer) const
void CPickup::SetAutoTimer(Int32 timer)
{
// Validate the managed identifier
Validate();
// Perform the requested operation
// Grab the current value for this property
const Int32 current = _Func->GetPickupAutoTimer(m_ID);
// Don't even bother if it's the same value
if (current == timer)
{
return;
}
// Avoid property unwind from a recursive call
_Func->SetPickupAutoTimer(m_ID, timer);
// Avoid infinite recursive event loops
if (!(m_CircularLocks & PICKUPCL_EMIT_PICKUP_AUTOTIMER))
{
// Prevent this event from triggering while executed
BitGuardU32 bg(m_CircularLocks, PICKUPCL_EMIT_PICKUP_AUTOTIMER);
// Now forward the event call
Core::Get().EmitPickupAutoTimer(m_ID, current, timer);
}
}
// ------------------------------------------------------------------------------------------------