Esempio n. 1
0
 public static int IndexOfCommodity(Station outputStation, string commodityName)
 {
     for (int i = 0; i < outputStation.Commodities.Count; i++)
         if (outputStation.Commodities[i].Name.Contains(commodityName))
             return i;
     return -1;
 }
Esempio n. 2
0
 public Station(Station copy)
 {
     commodities = new List<Commodity>();
     name = copy.Name;
     system = copy.SystemName;
     foreach (Commodity commodity in copy.Commodities)
         commodities.Add(new Commodity(commodity));
 }
Esempio n. 3
0
 public Trade(Trade copy)
 {
     commodity = new Commodity(copy.Commodity);
     startSystem = new StarSystem(copy.StartSystem);
     endSystem = new StarSystem(copy.EndSystem);
     startStation = new Station(copy.StartStation);
     endStation = new Station(copy.EndStation);
     unitsBought = copy.UnitsBought;
     score = copy.Score;
 }
Esempio n. 4
0
 public static void UpdateCommodities(Station outputStation, List<Commodity> outputCommodity)
 {
     int found;
     for (int i = 0; i < outputCommodity.Count; i++)
     {
         found = IndexOfCommodity(outputStation, outputCommodity[i].Name);
         if (found == -1)
             // Commodity not found, Add
             outputStation.Commodities.Add(outputCommodity[i]);
         else
             // Commodity found, Update
             // Only update if newer
             if (outputStation.Commodities[found].LastUpdated < outputCommodity[i].LastUpdated)
                 outputStation.Commodities[found] = outputCommodity[i];
     }
 }