pit lap detection in UI

This commit is contained in:
Scott Pruett 2022-06-09 18:24:45 -04:00
parent 3f51e731b1
commit bdaf6f56d7
3 changed files with 13 additions and 2 deletions

View File

@ -207,6 +207,17 @@ fn show_race_state(
let mut prev_lap: Option<&LapState> = None;
let fastest_lap = race.fastest_lap();
for (i, lap) in race.laps.iter_mut().enumerate() {
if let Some(prev) = &prev_lap {
if lap.gas.unwrap_or_default() > prev.gas.unwrap_or(usize::MAX) || lap.tyres.unwrap_or_default() > prev.tyres.unwrap_or(usize::MAX) {
ui.separator();
ui.separator();
ui.separator();
ui.separator();
ui.separator();
ui.separator();
ui.end_row();
}
}
if let Some(lap_time) = lap.lap_time {
ui.label(format!("#{}", lap.lap.unwrap_or(i + 1)));
ui.label(format!("P{}", lap.position.unwrap_or_default()));

View File

@ -143,7 +143,7 @@ impl RaceState {
}
pub fn fastest_lap(&self) -> Option<Duration> {
self.laps.iter().filter_map(|lap| lap.lap_time).min()
self.laps.iter().filter(|lap| !lap.striked).filter_map(|lap| lap.lap_time).min()
}
pub fn tyre_wear(&self) -> Option<usize> {

View File

@ -6,8 +6,8 @@
- Detect car name from load screen
- Post race metric charts
- Show during race instead of table (?)
- Fix 0 tyres parsing as ".0"
- [PARTIAL] TTS for pit strategies
- [DONE] Fix 0 tyres parsing as ".0"
- [DONE] Show delta positions
- [DONE] Track penalties
- [DONE] Re-do debug/learn functionality