/// <summary>
        /// Constructs the PlayersForm from a PlayerList
        /// </summary>
        /// <param name="list">contains a list of the players</param>
        public PlayersForm(PlayerList list)
        {
            InitializeComponent();
            playerList = list;
            source = new BindingSource();

            // Because PlayerComponents do not encapsulate all of their data within fields, we must adapt them to
            // do so that the UI can bind itself to the data source.
            // The adapter merely places all of the relevant data in fields, and allows us to change the player list before
            // commiting the changes to the actual player list.
            foreach (PlayerComponent player in list.GetChildren())
            {
                PlayerDataGridAdapter adapter = new PlayerDataGridAdapter(player, playerList);
                source.Add(adapter);
            }

            // Initialize Player List to bind data properly.
            uiPlayerList.AutoGenerateColumns = false;
            uiPlayerList.AutoSize = true;
            uiPlayerList.DataSource = source;

            name.DataPropertyName = "Player_Name";
            race.DataPropertyName = "RaceMember";
            gold.DataPropertyName = "GoldMember";
            wood.DataPropertyName = "WoodMember";
            metal.DataPropertyName = "MetalMember";
        }
        /// <summary>
        /// Update all players' units
        /// </summary>
        /// <param name="players">List of all players</param>
        private void UpdateAllPlayersUnits(PlayerList players)
        {
            foreach (PlayerComponent player in players.GetChildren())
            {
                UnitList units = player.GetUnitList();
                // Make a copy of the list that will not be tampered with by the attack action.
                List<UnitComponent> unitList = new List<UnitComponent>();
                foreach (UnitComponent unit in units.GetChildren())
                {
                    unitList.Add(unit);
                }
                foreach (UnitComponent unit in unitList)
                {
                    if (unit.State != ZRTSModel.UnitComponent.UnitState.DEAD)
                        unit.GetActionQueue().Work();
                }

                List<ModelComponent> buildings = player.BuildingList.GetChildren();

                foreach (Building b in buildings)
                {
                    b.BuildingActionQueue.Work();
                }
            }
        }