Exemplo n.º 1
0
        /// <summary>
        /// Finds if the bullet type exists in the list
        /// </summary>
        /// <param name="bt"> Takes object of BulletType to see if exists in list </param>
        /// <returns> Returns the index if found, else -1 </returns>
        public int Find(BulletBrand bt)
        {
            for (int i = 0; i < Brands.Count; ++i)
            {
                if (Brands[i] == bt)
                {
                    return(i);
                }
            }

            return(Program.NOINDEX);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a new bullet to the list if not already in there, else append data
        /// </summary>
        /// <param name="bt"></param>
        public void AddBulletBrand(BulletBrand bt)
        {
            int index = Find(bt);

            // Check if bullet type exists in the List, if so then append data
            // else add the whole data structure to the list of bullet types
            if (index > 0)
            {
                Brands.Add(bt);
            }
            else
            {
                // TODO
            }
        }