Пример #1
0
 private void CheckNeighbour(List <Country> countries, Country myCountry, Plot plot)
 {
     if (!myCountry.OwnsPlot(plot))
     {
         Country otherCountry = BelongsToACountry(countries, plot);
         if (otherCountry == null)
         {
             myCountry.ClaimPlot(plot);
         }
         else
         {
             countries.Remove(otherCountry);
             myCountry.Annex(otherCountry);
         }
     }
 }
Пример #2
0
        public List <Country> GetCountries(Map map)
        {
            List <Country> countries = new List <Country>();

            foreach (Plot plot in map)
            {
                Country myCountry = BelongsToACountry(countries, plot);
                if (myCountry == null)
                {
                    myCountry = new Country(plot.Colour);
                    myCountry.ClaimPlot(plot);
                    countries.Add(myCountry);
                }

                CheckNeighbours(countries, myCountry, plot, map);
            }

            return(countries);
        }