Skip to content

Commit

Permalink
Fixed wrong display of delta in practice/quali sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
ColonelChocomel committed Mar 15, 2022
1 parent 89bf6c2 commit a8eab95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ACCBroadcaster/Classes/Car.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ public string LapTimeMsToReadable(int? laptimeMs)
return $"{TimeSpan.FromMilliseconds((double)laptimeMs):mm\\:ss\\.fff}";
}

public string DeltaMsToReadable(int deltaMs)
public string DeltaMsToReadable(int deltaMs, bool canBeNegative)
{
string posOrNeg;
if (deltaMs < 0)
if (deltaMs < 0 && canBeNegative)
{
posOrNeg = "-";
} else
Expand Down
4 changes: 2 additions & 2 deletions ACCBroadcaster/Views/Broadcasting/CarListView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private void OnRealtimeCarUpdate(string sender, RealtimeCarUpdate carUpdate)
positionChanged = true;
}
car.Location = carUpdate.CarLocation;
car.LapDelta = car.DeltaMsToReadable(carUpdate.Delta);
car.LapDelta = car.DeltaMsToReadable(carUpdate.Delta, true);
car.CurrentLap = car.LapTimeMsToReadable(carUpdate.CurrentLap.LaptimeMS);
car.LastLap = car.LapTimeMsToReadable(carUpdate.LastLap.LaptimeMS);
car.BestLap = car.LapTimeMsToReadable(carUpdate.BestSessionLap.LaptimeMS);
Expand Down Expand Up @@ -119,7 +119,7 @@ private void OnRealtimeCarUpdate(string sender, RealtimeCarUpdate carUpdate)
if (car.BestLapMS > 0)
{
int lapDelta = carAhead.BestLapMS - car.BestLapMS;
car.PositionDelta = car.DeltaMsToReadable(lapDelta);
car.PositionDelta = car.DeltaMsToReadable(lapDelta, false);
}
}
else if (carAhead.SplinePosition > car.SplinePosition && carAhead.Lap == car.Lap)
Expand Down

0 comments on commit a8eab95

Please sign in to comment.