Example #1
0
        protected override DereferenceResult Perform(Homework reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            if (Matches(reference, "OwningSimDescription", field, objects))
            {
                if (Performing)
                {
                    ErrorTrap.AddToBeDeleted(reference, true);

                    Remove(ref reference.OwningSimDescription);
                }
                return(DereferenceResult.End);
            }

            if (Matches(reference, "HomeworkSoloJig", field, objects))
            {
                if (Performing)
                {
                    try
                    {
                        reference.HomeworkSoloJig.Destroy();
                    }
                    catch
                    { }

                    Remove(ref reference.HomeworkSoloJig);
                }
                return(DereferenceResult.End);
            }

            return(DereferenceResult.Failure);
        }
Example #2
0
        protected override DereferenceResult Perform(AttractionGift reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            if (Matches(reference, "mSimReceivingGift", field, objects))
            {
                //Remove(ref reference.mSimReceivingGift);

                ErrorTrap.AddToBeDeleted(reference, false);
                return(DereferenceResult.End);
            }

            return(DereferenceResult.Failure);
        }
Example #3
0
        protected override DereferenceResult Perform(SculptureFrozenSim reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            if (Matches(reference, "mFrozenSim", field, objects))
            {
                Remove(ref reference.mFrozenSim);

                if (Performing)
                {
                    ErrorTrap.AddToBeDeleted(reference, true);
                }

                return(DereferenceResult.End);
            }

            return(DereferenceResult.Failure);
        }
Example #4
0
        protected override DereferenceResult Perform(FireManager reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            if (Matches(reference, "mWindowFires", field, objects))
            {
                Remove(reference.mWindowFires, objects);
                return(DereferenceResult.End);
            }

            if (Matches(reference, "mObjectsToRestore", field, objects))
            {
                if (Performing)
                {
                    EmergencyFireRestorer obj = FindLast <EmergencyFireRestorer>(objects);
                    if (obj != null)
                    {
                        ErrorTrap.AddToBeDeleted(obj.mObject, true);
                    }

                    Remove(reference.mObjectsToRestore, objects);
                }

                return(DereferenceResult.End);
            }

            if (Matches(reference, "mSimsReactedToFire", field, objects))
            {
                Remove(reference.mSimsReactedToFire, objects);
                return(DereferenceResult.End);
            }

            ReferenceWrapper result;

            if (Matches(reference, "mFireSource", field, objects, out result) != MatchResult.Failure)
            {
                if (Performing)
                {
                    if (result.Valid)
                    {
                        Remove(ref reference.mFireSource);
                    }
                }
                return(DereferenceResult.End);
            }

            return(DereferenceResult.Failure);
        }
Example #5
0
        protected override DereferenceResult Perform(Sim.Placeholder reference, FieldInfo field, List <ReferenceWrapper> objects)
        {
            if (Matches(reference, "mSimDescription", field, objects))
            {
                if (Performing)
                {
                    ErrorTrap.AddToBeDeleted(reference, true);

                    Remove(ref reference.mSimDescription);
                    return(DereferenceResult.End);
                }
                else
                {
                    return(DereferenceResult.Found);
                }
            }

            return(DereferenceResult.Failure);
        }
Example #6
0
        protected override bool PrePerform(GameObject obj, bool postLoad)
        {
            if (obj.InInventory)
            {
                Inventory inventory = Inventory.ParentInventory(obj);
                if (inventory != null)
                {
                    if (inventory.Owner == null)
                    {
                        ErrorTrap.AddToBeDeleted(obj, true);

                        LogCorrection("Corrupt Inventory Object Deleted: " + ErrorTrap.GetName(obj));
                    }
                }
            }

            if (obj.Inventory != null)
            {
                Inventories.CheckInventory(LogCorrection, DebugLogCorrection, ErrorTrap.GetName(obj), obj.Inventory, false);
            }

            ObjectComponents.Cleanup(obj, DebugLogCorrection);
            return(true);
        }
Example #7
0
        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);
                }
            }
        }