コード例 #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);
        }
コード例 #2
0
 public bool HasRelationWith(ExtSDesc sdsc)
 {
     foreach (uint inst in this.Relations.SimInstances)
     {
         if (sdsc.FileDescriptor.Instance == inst)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #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;
        }
コード例 #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)");
            }
        }
コード例 #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);
        }
コード例 #6
0
 public uint GetRelationInstance(ExtSDesc sdesc)
 {
     return(((this.FileDescriptor.Instance & 0xffff) << 16) | (sdesc.FileDescriptor.Instance & 0xffff));
 }
コード例 #7
0
 public ExtSrel FindRelation(ExtSDesc sdesc)
 {
     return(FindRelation(this, sdesc));
 }
コード例 #8
0
 public static ExtSrel FindRelation(ExtSDesc src, ExtSDesc dst)
 {
     return(FindRelation(src, src, dst));
 }
コード例 #9
0
 internal ExtSrel GetCachedRelation(ExtSDesc sdesc)
 {
     return(this.GetCachedRelation(GetRelationInstance(sdesc)));
 }
コード例 #10
0
 public void RemoveRelation(ExtSDesc sdesc)
 {
     Relations.SimInstances = (ushort[])Helper.Delete(Relations.SimInstances, (ushort)sdesc.FileDescriptor.Instance);
     this.Changed           = true;
 }