} = new List <string>(); //Debrief Eval public ActivityTaskPassengerStopAt(Simulator simulator, ActivityTask prev, int arrivalTime, int departureTime, PlatformItem platformStart, PlatformItem platformeEnd) { this.simulator = simulator; ScheduledArrival = TimeSpan.FromSeconds(arrivalTime); ScheduledDeparture = TimeSpan.FromSeconds(departureTime); PlatformEnd1 = platformStart; PlatformEnd2 = platformeEnd; PrevTask = prev; if (prev != null) { prev.NextTask = this; } DisplayMessage = ""; logStationStops = false; logStationLogFile = null; }
public Activity(ActivityFile activityFile, Simulator simulator) { if (null == activityFile) { throw new ArgumentNullException(nameof(activityFile)); } this.simulator = simulator; // Save for future use. PlayerServices sd; sd = activityFile.Activity.PlayerServices; if (sd != null) { if (sd.PlayerTraffics.Count > 0) { ActivityTask task = null; foreach (ServiceTrafficItem i in sd.PlayerTraffics) { PlatformItem Platform; if (i.PlatformStartID < this.simulator.TrackDatabase.TrackDB.TrackItems.Length && i.PlatformStartID >= 0 && this.simulator.TrackDatabase.TrackDB.TrackItems[i.PlatformStartID] is PlatformItem) { Platform = this.simulator.TrackDatabase.TrackDB.TrackItems[i.PlatformStartID] as PlatformItem; } else { Trace.TraceWarning("PlatformStartID {0} is not present in TDB file", i.PlatformStartID); continue; } if (Platform != null) { if (this.simulator.TrackDatabase.TrackDB.TrackItems[Platform.LinkedPlatformItemId] is PlatformItem) { PlatformItem Platform2 = this.simulator.TrackDatabase.TrackDB.TrackItems[Platform.LinkedPlatformItemId] as PlatformItem; Tasks.Add(task = new ActivityTaskPassengerStopAt(simulator, task, i.ArrivalTime, i.DepartTime, Platform, Platform2)); } } } ActivityTask = Tasks[0]; } } // Compile list of freight events, if any, from the parsed ACT file. foreach (ActivityEvent activityEvent in activityFile.Activity?.Events ?? Enumerable.Empty <ActivityEvent>()) { if (activityEvent is ActionActivityEvent) { EventList.Add(new EventCategoryActionWrapper(activityEvent)); } if (activityEvent is LocationActivityEvent) { EventList.Add(new EventCategoryLocationWrapper(activityEvent)); } if (activityEvent is TimeActivityEvent) { EventList.Add(new EventCategoryTimeWrapper(activityEvent)); } EventWrapper eventAdded = EventList.Last(); eventAdded.OriginalActivationLevel = activityEvent.ActivationLevel; if (activityEvent.WeatherChange != null || activityEvent.Outcomes.WeatherChange != null) { WeatherChangesPresent = true; } } stationStopLogActive = false; stationStopLogFile = null; }