예제 #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);
        }
예제 #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.
 }
예제 #3
0
 public bool ValidateKerbal(Kerbal k)
 {
     foreach (string kerb in kerbals.Keys)
     {
         if (kerb.ToLower( ).Equals(k.GetName( ).ToLower( )))
         {
             return(false);
         }
     }
     return(true);
 }