public static IEnumerable <TrainItem> GetItems(TrainCategory trainCategory = TrainCategory.All) { var list = new List <TrainItem>(); _ids.Where(kvp => (kvp.Key & trainCategory) != 0).Select(kvp => kvp.Value).ForEach(a => list.AddRange(a)); return(list); }
public static void CustomConversions(VehicleInfo info, long id, TrainCategory trainCategory) { { if (info.m_trailers != null && info.m_trailers.Length > 0) //TODO(earalov): implement take trailers feature { switch (id) { default: break; } } if (!Trains.ReplaceLastCar(id, trainCategory)) { return; } if (info.m_trailers != null && info.m_trailers.Length > 0) { info.m_trailers[info.m_trailers.Length - 1] = new VehicleInfo.VehicleTrailer() { m_info = info, m_probability = 100, m_invertProbability = 100 }; } } }
public static bool ReplaceLastCar(long id, TrainCategory trainCategory) { var list = new List <long>(); Ids.Where(kvp => (kvp.Key & trainCategory) != 0).Select(kvp => kvp.Value).ForEach(l => l.ForEach(t => { if (t.ReplaceLastTrailerWithEngine) { list.Add(t.WorkshopId); } })); return(list.Contains(id)); }
public static long[] GetConvertedIds(TrainCategory trainCategory = TrainCategory.All) { var list = new List <long>(); Ids.Where(kvp => IsCategoryEnabled(kvp.Key) && (kvp.Key & trainCategory) != 0).Select(kvp => kvp.Value).ForEach(l => l.ForEach(t => { if (!t.Exclude) { list.Add(t.WorkshopId); } })); return(list.ToArray()); }
private static bool IsCategoryEnabled(TrainCategory trainCategory) { switch (trainCategory) { case TrainCategory.Underground: return(OptionsWrapper <Options> .Options.ConvertSubwayTrainsToMetros); case TrainCategory.SBahn: return(OptionsWrapper <Options> .Options.ConvertSBahnsToMetros); case TrainCategory.Pantograph: return(OptionsWrapper <Options> .Options.ConvertPantographsToMetros); case TrainCategory.Tram: return(OptionsWrapper <Options> .Options.ConvertTrainsToTrams && Util.DLC(SteamHelper.kWinterDLCAppID)); default: throw new ArgumentOutOfRangeException(nameof(trainCategory), trainCategory, null); } }
public override int GetHashCode() { unchecked { var hashCode = (AtocCode != null ? AtocCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AtsCode != null ? AtsCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)BankHolidayRunning; hashCode = (hashCode * 397) ^ (int)CateringCode; hashCode = (hashCode * 397) ^ (ConnectionIndicator != null ? ConnectionIndicator.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CourseIndicator != null ? CourseIndicator.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DataSource != null ? DataSource.GetHashCode() : 0); hashCode = (hashCode * 397) ^ DateRunsFrom.GetHashCode(); hashCode = (hashCode * 397) ^ DateRunsTo.GetHashCode(); hashCode = (hashCode * 397) ^ (HeadCode != null ? HeadCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)OperatingCharacteristics; hashCode = (hashCode * 397) ^ (OperatingCharacteristicsString != null ? OperatingCharacteristicsString.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PortionId != null ? PortionId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)PowerType; hashCode = (hashCode * 397) ^ (int)RecordIdentity; hashCode = (hashCode * 397) ^ (int)Reservations; hashCode = (hashCode * 397) ^ (Rsid != null ? Rsid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)RunningDays; hashCode = (hashCode * 397) ^ (ScheduleLocations != null ? ScheduleLocations.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)SeatingClass; hashCode = (hashCode * 397) ^ (int)ServiceBranding; hashCode = (hashCode * 397) ^ (int)ServiceTypeFlags; hashCode = (hashCode * 397) ^ (int)Sleepers; hashCode = (hashCode * 397) ^ Speed; hashCode = (hashCode * 397) ^ (int)StpIndicator; hashCode = (hashCode * 397) ^ (TimingLoad != null ? TimingLoad.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainCategory != null ? TrainCategory.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainIdentity != null ? TrainIdentity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainServiceCode != null ? TrainServiceCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainStatus != null ? TrainStatus.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TrainUid != null ? TrainUid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (UicCode != null ? UicCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (UniqueId != null ? UniqueId.GetHashCode() : 0); return(hashCode); } }
public Train(TrainCategory category, string identity) { Category = category; CategoryText = Resources.TrainCategory.ResourceManager.GetString(category.ToString()); Identity = identity; }