예제 #1
0
        private void CullDegenerateOceans()
        {
            ConnectivityChecker <District> connectivityChecker = new ConnectivityChecker <District>(new AdHocGraph <District>(new List <District>(from d in base.Context.Districts.Values
                                                                                                                                                  where d.Content == District.Contents.Ocean
                                                                                                                                                  select d)));

            connectivityChecker.Execute();
            foreach (HashSet <District> hashSet in connectivityChecker.ConnexNodeSets)
            {
                if (hashSet.Sum((District d) => d.Count) < 30)
                {
                    HashSet <byte> source = new HashSet <byte>(from d in hashSet
                                                               from n in d.Neighbours
                                                               where n.ContinentId > 0
                                                               select n.ContinentId);
                    foreach (District district in hashSet)
                    {
                        district.Content     = District.Contents.Land;
                        district.ContinentId = source.First <byte>();
                        foreach (HexPos hexPos in district)
                        {
                        }
                    }
                }
            }
        }
예제 #2
0
        protected void ConfirmContinents()
        {
            foreach (CreateContinents.Continent continent in this.Continents)
            {
                foreach (CreateContinents.Blob blob in continent.Blobs)
                {
                    foreach (District district in blob.Districts)
                    {
                        district.Content     = District.Contents.Land;
                        district.ContinentId = (byte)continent.Id;
                    }
                }
                string   format = "Continent {0} : {1} hexes - {2} blobs - {3} districts";
                object[] array  = new object[4];
                array[0] = continent.Id;
                array[1] = continent.HexCount;
                array[2] = continent.Blobs.Count;
                array[3] = continent.Blobs.Sum((CreateContinents.Blob b) => b.Districts.Count);
                base.Trace(string.Format(format, array));
            }
            this.CullDegenerateOceans();
            ConnectivityChecker <District> connectivityChecker = new ConnectivityChecker <District>(new AdHocGraph <District>(from d in base.Context.Districts.Values
                                                                                                                              where d.Content == District.Contents.Land
                                                                                                                              select d));

            connectivityChecker.Execute();
            base.Context.Settings.LandMasses = connectivityChecker.ConnexNodeSets.Count;
        }
예제 #3
0
        protected void UnifyBlobGraph()
        {
            ConnectivityChecker <CreateContinents.Blob> blobConnexer = new ConnectivityChecker <CreateContinents.Blob>(this.BlobGraph);

            blobConnexer.Execute();
            if (blobConnexer.ConnexNodeSets.Count > 1)
            {
                this.CoreBlobs.RemoveAll((CreateContinents.Blob b) => !blobConnexer.ConnexNodeSets.First <HashSet <CreateContinents.Blob> >().Contains(b));
                this.BlobGraph = new AdHocGraph <CreateContinents.Blob>(this.CoreBlobs);
            }
        }