overtakes are now detected and displayed

This commit is contained in:
2023-05-24 16:40:51 +02:00
parent 03130f6c42
commit 5421b5071b
2 changed files with 37 additions and 0 deletions

View File

@@ -209,6 +209,38 @@ namespace Test_Merge
}
}
}
public void DisplayOvertakes(ListBox lsbResult)
{
if (LiveDriverDataLogs.Count > 1)
{
List<DriverData> oldList = LiveDriverDataLogs[LiveDriverDataLogs.Count - 2];
List<DriverData> newList = LiveDriverDataLogs[LiveDriverDataLogs.Count - 1];
for (int i = 0; i < LiveDriverDataLogs[LiveDriverDataLogs.Count - 1].Count;i++)
{
if (oldList[i].Name != newList[i].Name) {
//There has been a change in the standings
for(int y = 0; y < oldList.Count;y++)
{
if (newList[y].Name == oldList[i].Name)
{
//We found its new location
if (y > i)
{
//The driver overtook someone
lsbResult.Items.Add(newList[y].Name + " climbed to " + y);
}
else
{
//The driver got overtook by someone
lsbResult.Items.Add(newList[y].Name + " fell to " + y);
}
}
}
}
}
}
}
public void DisplayLapTimeInfos(string driverName, int Lap, string LapTime)
{
List<int> sectors = Storage.GetSectorsFromLapTime(driverName, Lap);

View File

@@ -118,6 +118,7 @@ namespace Test_Merge
DisplayResults(errorCode, sw, screen);
DisplayBattles();
DisplayDeltas();
DisplayOvertakes();
});
});
}
@@ -134,6 +135,10 @@ namespace Test_Merge
btnSettings.Enabled = true;
}
}
private void DisplayOvertakes()
{
Wrapper.DisplayOvertakes(lsbOvertakes);
}
private void DisplayBattles()
{
Wrapper.DisplayBattles(pnlBattles,this);