Esempio n. 1
0
        public ExtSrel CreateRelation(ExtSDesc sdesc)
        {
            ExtSrel srel = new ExtSrel();
            uint    inst = GetRelationInstance(sdesc);

            srel.FileDescriptor        = package.NewDescriptor(Data.MetaData.RELATION_FILE, 0, this.FileDescriptor.Group, inst);
            srel.RelationState.IsKnown = true;

            return(srel);
        }
Esempio n. 2
0
 public bool HasRelationWith(ExtSDesc sdsc)
 {
     foreach (uint inst in this.Relations.SimInstances)
     {
         if (sdsc.FileDescriptor.Instance == inst)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 3
0
        public void AddRelation(ExtSDesc sdesc)
        {
            foreach (ushort inst in Relations.SimInstances)
            {
                if (inst == (ushort)sdesc.FileDescriptor.Instance)
                {
                    return;
                }
            }

            Relations.SimInstances = (ushort[])Helper.Add(Relations.SimInstances, (ushort)sdesc.FileDescriptor.Instance);
            this.Changed           = true;
        }
Esempio n. 4
0
        protected override string GetResourceName(TypeAlias ta)
        {
            //if (!SimPe.Custom.Settings.SimNames) return base.GetResourceName(ta);
            ExtSDesc sdsc = FileTable.ProviderRegistry.SimDescriptionProvider.FindSim((ushort)this.FileDescriptor.Instance) as ExtSDesc;

            if (sdsc == null)
            {
                return(base.GetResourceName(ta));
            }
            else
            {
                return(sdsc.SimName + " " + sdsc.SimFamilyName + " (Scores)");
            }
        }
Esempio n. 5
0
        public static ExtSrel FindRelation(ExtSDesc cache, ExtSDesc src, ExtSDesc dst)
        {
            uint sinst = src.GetRelationInstance(dst);

            SimPe.PackedFiles.Wrapper.ExtSrel srel = cache.GetCachedRelation(sinst);
            if (srel == null)
            {
                SimPe.Interfaces.Files.IPackedFileDescriptor spfd = cache.Package.FindFile(Data.MetaData.RELATION_FILE, 0, cache.FileDescriptor.Group, sinst);

                if (spfd != null)
                {
                    srel = new SimPe.PackedFiles.Wrapper.ExtSrel();
                    srel.ProcessData(spfd, cache.Package);
                }
            }

            return(srel);
        }
Esempio n. 6
0
 public uint GetRelationInstance(ExtSDesc sdesc)
 {
     return(((this.FileDescriptor.Instance & 0xffff) << 16) | (sdesc.FileDescriptor.Instance & 0xffff));
 }
Esempio n. 7
0
 public ExtSrel FindRelation(ExtSDesc sdesc)
 {
     return(FindRelation(this, sdesc));
 }
Esempio n. 8
0
 public static ExtSrel FindRelation(ExtSDesc src, ExtSDesc dst)
 {
     return(FindRelation(src, src, dst));
 }
Esempio n. 9
0
 internal ExtSrel GetCachedRelation(ExtSDesc sdesc)
 {
     return(this.GetCachedRelation(GetRelationInstance(sdesc)));
 }
Esempio n. 10
0
 public void RemoveRelation(ExtSDesc sdesc)
 {
     Relations.SimInstances = (ushort[])Helper.Delete(Relations.SimInstances, (ushort)sdesc.FileDescriptor.Instance);
     this.Changed           = true;
 }