Ejemplo n.º 1
0
void C4Effect::TempRemoveUpperEffects(C4Object *pObj, bool fTempRemoveThis,
                                      C4Effect **ppLastRemovedEffect) {
  if (pObj && !pObj->Status)
    return; // this will be invalid!
  // priority=1: no callbacks
  if (iPriority == 1)
    return;
  // remove from high to low priority
  // recursive implementation...
  C4Effect *pEff = pNext;
  while (pEff)
    if (pEff->IsActive())
      break;
    else
      pEff = pEff->pNext;
  // temp remove active effects with higher priority
  if (pEff)
    pEff->TempRemoveUpperEffects(pObj, true, ppLastRemovedEffect);
  // temp remove this
  if (fTempRemoveThis) {
    FlipActive();
    // temp callbacks only for higher priority effects
    if (pFnStop && iPriority != 1)
      pFnStop->Exec(pCommandTarget,
                    &C4AulParSet(C4VObj(pObj), C4VInt(iNumber),
                                 C4VInt(C4FxCall_Temp), C4VBool(true)));
    if (!*ppLastRemovedEffect)
      *ppLastRemovedEffect = this;
  }
}
Ejemplo n.º 2
0
void C4Effect::TempRemoveUpperEffects(bool fTempRemoveThis, C4Effect **ppLastRemovedEffect)
{
	if (Target && !Target->Status) return; // this will be invalid!
	// priority=1: no callbacks
	if (iPriority == 1) return;
	// remove from high to low priority
	// recursive implementation...
	C4Effect *pEff = pNext;
		while (pEff) if (pEff->IsActive()) break; else pEff = pEff->pNext;
	// temp remove active effects with higher priority
	if (pEff) pEff->TempRemoveUpperEffects(true, ppLastRemovedEffect);
	// temp remove this
	if (fTempRemoveThis)
	{
		FlipActive();
		// Update OnFire cache
		if (Target && WildcardMatch(C4Fx_AnyFire, GetName()))
			if (!Get(C4Fx_AnyFire))
				Target->SetOnFire(false);
		// temp callbacks only for higher priority effects
		if (iPriority!=1) CallStop(C4FxCall_Temp, true);
		if (!*ppLastRemovedEffect) *ppLastRemovedEffect = this;
	}
}