Esempio n. 1
0
 /// <summary>
 /// Tries to handle merging stocks of the next corporation, if there are none then the merging of tiles is done, and merge is ended.
 /// </summary>
 /// <returns>True if there is more to do (iterator)</returns>
 public bool mergeNext()
 {
     if (notifyDefunctStock())
     {
         return(true);
     }
     // No more stocks to do
     foreach (Corporation c in mergerCorporations)
     {
         if (c != overtaker)
         {
             c.mergeInto(overtaker);
         }
     }
     // Gather unincorporated tiles and connector and add them as well
     overtaker.expand(getUnincorporatedTiles());
     return(false);
 }
        /// <summary>
        /// Expands the corporation to include the unincorporated tiles.
        /// </summary>
        /// <param name="corporations">A list of corporations</param>
        public override bool resolveIntersection(Corporation[] corporations)
        {
            List <Tile> unincorporated = new List <Tile>();
            Corporation corporation    = null;

            foreach (Tile t in adjacentTiles)
            {
                if (t.Corp != null)
                {
                    corporation = t.Corp;
                }
                else
                {
                    unincorporated.Add(t);
                }
            }
            unincorporated.Add(connector);
            corporation.expand(unincorporated);
            return(true);
        }