public Lap GetBastLap() { if (m_qualiLaps.Count == 0) { return(new Lap(TimeSpan.Zero, false)); } Lap bestLap = m_qualiLaps.First(); foreach (Lap lap in m_qualiLaps) { // Use more than to skip instead of just checking for less then in case the driver matched a previous // best time that included a cut, with a new lap that didn't have a cut. if (lap.LapTime > bestLap.LapTime) { continue; } // Case for if the driver matched a previous best time, but with a cut. This shouldn't be counted. if (lap.LapTime == bestLap.LapTime && lap.DidCut) { continue; } bestLap = lap; } return(bestLap); }
private static void OutputCutBestLaps() { foreach (Driver driver in m_driversFromCarID.Values) { Lap bestlap = driver.GetBastLap(); if (bestlap.DidCut) { WriteLog($"[Cut-Quali] : {driver.Name} - {bestlap.LapTime}"); } } }