private bool HasSameTargets(Commands.ICommand cmd1, Commands.ICommand cmd2) { if (cmd1.AffectsMultiplePrims() != cmd2.AffectsMultiplePrims()) { m_log.ErrorFormat("[InWorldz.PhysxPhysics] Asked to check command targets for different command types!"); return false; } if (cmd1.AffectsMultiplePrims()) { IEnumerator<PhysxPrim> cmd1prims = ((Commands.IMultiPrimCommand)cmd1).GetTargetPrims().GetEnumerator(); IEnumerator<PhysxPrim> cmd2prims = ((Commands.IMultiPrimCommand)cmd2).GetTargetPrims().GetEnumerator(); bool cmd1end = false; bool cmd2end = false; while (true) { cmd1end = cmd1prims.MoveNext(); cmd2end = cmd2prims.MoveNext(); if (cmd1end || cmd2end) break; if (cmd1prims.Current != cmd2prims.Current) return false; } return cmd1end == cmd2end; } else { return cmd1.GetTargetPrim() == cmd2.GetTargetPrim(); } }
private bool CheckDelayedCommand(Commands.ICommand cmd) { if (cmd.AffectsMultiplePrims()) { bool delay = false; Commands.IMultiPrimCommand mpCommand = (Commands.IMultiPrimCommand)cmd; IEnumerable<PhysxPrim> targets = mpCommand.GetTargetPrims(); foreach (PhysxPrim target in targets) { delay |= CheckAddDelay(cmd, target); } //if (delay) m_log.DebugFormat("[InWorldz.PhysX] Delaying physics command pending command completion"); return delay; } else { PhysxPrim target = cmd.GetTargetPrim(); if (target == null) { return false; } return CheckAddDelay(cmd, target); } }