static void ApplyHasSeenCheckeredFlag(DataSample data, bool[] hasSeenCheckeredFlag) { if (data.LastSample != null && data.Telemetry.LeaderHasFinished) { for (int i = 1; i < data.SessionData.DriverInfo.CompetingDrivers.Length; i++) { if (data.LastSample.Telemetry.CarIdxLapDistPct[i] > 0.90 && data.Telemetry.CarIdxLapDistPct[i] < 0.10) { hasSeenCheckeredFlag[i] = true; } } } data.Telemetry.HasSeenCheckeredFlag = hasSeenCheckeredFlag; }
/// <summary> /// Mixes in the LastSample field /// Also disconnect the link list - so only the immediate sample has ref to last sample. /// </summary> public static IEnumerable <DataSample> WithLastSample(this IEnumerable <DataSample> samples) { DataSample lastDataSample = null; foreach (var data in samples) { data.LastSample = lastDataSample; if (lastDataSample != null) { lastDataSample.LastSample = null; } lastDataSample = data; yield return(data); } }
static void ApplyIsFinalLap(DataSample data) { data.Telemetry.IsFinalLap = data.Telemetry.RaceLaps >= data.SessionData.SessionInfo.Sessions[data.Telemetry.SessionNum].ResultsLapsComplete; }