Example #1
0
        public Roster KreateRoster(RandomAccumulator ra, Roster currentRoster)
        {
            SpecificAccumulator sa;
            Roster returnRoster = new Roster( );

            Logger.LogEvent("Generating a new Roster");
            for (int i = 0; i < ra.NumberToCreate; i++)
            {
                sa = RandomToSpecificAccumulator(ra);
                Kerbal k = KreateKerbal(sa);
                //validate our kerbal
                if (!currentRoster.ValidateKerbal(k))
                {
                    i--;
                }
                else
                {
                    //if the kerbal is valid, increment our counts,
                    //and add the kerbal.
                    incrementCounts(sa);
                    returnRoster.AddKerbal(k);
                }
            }
            //reset our temp values below.

            return(returnRoster);
        }
Example #2
0
 public void AddKerbal(Kerbal k)
 {
     //make sure K doesn't exist in roster
     if (!(kerbals.ContainsKey(k.GetName( ))))
     {
         kerbals.Add(k.GetName( ), k);
     }
     //it used to erase and add here.
 }
Example #3
0
 public bool ValidateKerbal(Kerbal k)
 {
     foreach (string kerb in kerbals.Keys)
     {
         if (kerb.ToLower( ).Equals(k.GetName( ).ToLower( )))
         {
             return(false);
         }
     }
     return(true);
 }