Implement a new event to receive notifications when a pickup automatic status has changed.

This commit is contained in:
Sandu Liviu Catalin committed 2016-08-19 18:21:41 +03:00
1 parent 3def96b57a
commit cdc0ac7585
5 files changed
+37 -6

No files matched your search

+17 -2
View File
@@ -233,12 +233,27 @@ bool CPickup::GetAutomatic() const
}
// ------------------------------------------------------------------------------------------------
void CPickup::SetAutomatic(bool toggle) const
void CPickup::SetAutomatic(bool toggle)
{
// Validate the managed identifier
Validate();
// Perform the requested operation
// Grab the current value for this property
const bool current = _Func->IsPickupAutomatic(m_ID);
// Don't even bother if it's the same value
if (current == toggle)
{
return;
}
// Avoid property unwind from a recursive call
_Func->SetPickupIsAutomatic(m_ID, toggle);
// Avoid infinite recursive event loops
if (!(m_CircularLocks & PICKUPCL_EMIT_PICKUP_AUTOMATIC))
{
// Prevent this event from triggering while executed
BitGuardU32 bg(m_CircularLocks, PICKUPCL_EMIT_PICKUP_AUTOMATIC);
// Now forward the event call
Core::Get().EmitPickupAutomatic(m_ID, current, toggle);
}
}
// ------------------------------------------------------------------------------------------------