protected override void Perform(EventListener obj, object parent, FieldInfo field) { if (!DereferenceManager.HasBeenDestroyed(obj.TargetObject)) { return; } if (DereferenceManager.Perform(obj, ObjectLookup.GetReference(new ReferenceWrapper(obj)), false, false)) { EventTracker.RemoveListener(obj); obj.CompletionDelegate = null; obj.mScriptObject = null; obj.mTargetObject = null; DelegateListener delListener = obj as DelegateListener; if (delListener != null) { delListener.mProcessEvent = null; } DereferenceManager.Perform(obj, ObjectLookup.GetReference(new ReferenceWrapper(obj)), true, false); } }
protected override void Perform(GameObject obj, object referenceParent, FieldInfo field) { if (obj is Ocean) { if (LotManager.sOceanObject == obj) { return; } } else if (obj is Terrain) { if (Terrain.sTerrain == obj) { return; } } if (DereferenceManager.HasBeenDestroyed(obj)) { if (obj is Sim) { LotManager.sActorList.Remove(obj as Sim); DereferenceManager.Perform(obj, ObjectLookup.GetReference(new ReferenceWrapper(obj)), true, false); } else { GameObjectReference refObj = ObjectLookup.GetReference(new ReferenceWrapper(obj)); if (DereferenceManager.Perform(obj, refObj, false, false)) { DereferenceManager.Perform(obj, refObj, true, false); ErrorTrap.LogCorrection("Destroyed Object Found: " + obj.GetType()); } } return; } if (kShowFullReferencing) { DereferenceManager.Perform(obj, ObjectLookup.GetReference(new ReferenceWrapper(obj)), false, true); } if (obj.InWorld) { return; } if (obj.InInventory) { if (Inventories.ParentInventory(obj) == null) { if ((obj.Parent != null) || (Consignment.ContainsKey(obj))) { obj.SetFlags(GameObject.FlagField.InInventory, false); ErrorTrap.LogCorrection("Invalid Inventory Object Unflagged: " + obj.GetType()); } else { ErrorTrap.LogCorrection("Invalid Inventory Object Found: " + obj.GetType()); ErrorTrap.AddToBeDeleted(obj, true); } } return; } else { if (SharedInventories.ContainsKey(obj.ObjectId)) { obj.SetFlags(GameObject.FlagField.InInventory, true); ErrorTrap.LogCorrection("Inventory Object Flagged: " + obj.GetType()); return; } } if (EventItems.ContainsKey(obj.ObjectId)) { return; } bool hasParent = false; IGameObject parent = obj.Parent; while (parent != null) { hasParent = true; if (DereferenceManager.HasBeenDestroyed(parent)) { ErrorTrap.LogCorrection("Destroyed Parent Object Found: " + parent.GetType()); ErrorTrap.AddToBeDeleted(obj, true); hasParent = false; break; } parent = parent.Parent; } if (!hasParent) { ReferenceWrapper refObj = new ReferenceWrapper(obj); GameObjectReference reference = ObjectLookup.GetReference(refObj); if ((reference != null) && (reference.HasReferences)) { if (DereferenceManager.Perform(obj, ObjectLookup.GetReference(refObj), false, false)) { IScriptProxy proxy = Simulator.GetProxy(obj.ObjectId); if (proxy != null) { IScriptLogic logic = proxy.Target; if (object.ReferenceEquals(logic, obj)) { bool log = !sSilentDestroy.ContainsKey(obj.GetType()); if (log) { ErrorTrap.LogCorrection("Out of World Object Found 2: " + obj.GetType()); } else { ErrorTrap.DebugLogCorrection("Out of World Object Found 3: " + obj.GetType()); } ErrorTrap.AddToBeDeleted(obj, log); } else { ErrorTrap.DebugLogCorrection("Out of World Object Found 4: " + obj.GetType()); ErrorTrap.DebugLogCorrection("Out of World Object Found 5: " + logic.GetType()); } } else { DereferenceManager.Perform(obj, ObjectLookup.GetReference(refObj), true, false); } } } else { ErrorTrap.LogCorrection("Out of World Object Found 1: " + obj.GetType()); ErrorTrap.AddToBeDeleted(obj, true); } } }