Use rFactor typical angled ui elements #6

Merged
hodasemi merged 12 commits from dev into master 2023-01-20 22:15:16 +00:00
Showing only changes of commit 14030b137e - Show all commits

View file

@ -172,15 +172,7 @@ impl LeaderBoard {
vehicle_scoring.mID,
driver_name,
vehicle_scoring.mPlace,
{
let laps_behind = vehicle_scoring.mLapsBehindLeader;
if laps_behind != 0 {
BehindLeader::Laps(laps_behind)
} else {
BehindLeader::Time(vehicle_scoring.mTimeBehindLeader)
}
},
Self::query_behind_leader(vehicle_scoring),
vehicle_scoring.mTimeBehindNext,
vehicle_scoring.mBestLapTime,
)?;
@ -334,18 +326,20 @@ impl LeaderBoard {
Ok(())
}
fn query_behind_leader(scoring: &VehicleScoringInfoV01) -> BehindLeader {
let laps_behind = scoring.mLapsBehindLeader;
if laps_behind != 0 {
BehindLeader::Laps(laps_behind)
} else {
BehindLeader::Time(scoring.mTimeBehindLeader)
}
}
fn race_leaderboard(&mut self, vehicle_scorings: &[VehicleScoringInfoV01]) -> Result<()> {
self.update_leaderboard(
vehicle_scorings,
|entry, scoring| {
let laps_behind = scoring.mLapsBehindLeader;
if laps_behind != 0 {
entry.update_time_behind_leader(BehindLeader::Laps(laps_behind))
} else {
entry.update_time_behind_leader(BehindLeader::Time(scoring.mTimeBehindLeader))
}
},
|entry, scoring| entry.update_time_behind_leader(Self::query_behind_leader(scoring)),
|entry| entry.force_display_behind_leader(),
)
}