I'm having a bit of trouble determining the time gap between 2 drivers and would appreciate some help, please.
For the purposes of discussion imagine a race with 2 drivers called "A" and "B".
There are 3 distinct cases that I can see:
1. Drivers A and B are on the same lap.
2. Driver A has completed more laps than driver B but driver B is ahead of A on the track (e.g. driver A has completed 6 laps, driver B has completed 5 laps but driver B has not yet been lapped).
3. Driver A has completed more laps than driver B and driver A is ahead of driver B on the track (e.g. driver A has completed 6 laps, driver B has completed 5 laps AND has been passed by driver A on the track).
If the drivers are on the same lap (or case 2 is true and the difference in laps completed is 1) the gap should be displayed as a time whereas if cases 2 or 3 are true and the difference in laps completed is greater than 1 the gap should be displayed as a number of laps.
The problems I'm having are:
Determining whether case 2 or 3 is true if the drivers are on different laps. I think the best way is to use their current node index (from the IS_NLP packet).
Determining the time gap if case 2 is true and the laps completed difference is 1. In this case I think you would just take the split time for the last completed split of the driver behind and subtract the split time at the same point of the player ahead on their last lap.
Am I on the right lines? Am I missing something obvious? Am I going insane with these questions?
For the purposes of discussion imagine a race with 2 drivers called "A" and "B".
There are 3 distinct cases that I can see:
1. Drivers A and B are on the same lap.
2. Driver A has completed more laps than driver B but driver B is ahead of A on the track (e.g. driver A has completed 6 laps, driver B has completed 5 laps but driver B has not yet been lapped).
3. Driver A has completed more laps than driver B and driver A is ahead of driver B on the track (e.g. driver A has completed 6 laps, driver B has completed 5 laps AND has been passed by driver A on the track).
If the drivers are on the same lap (or case 2 is true and the difference in laps completed is 1) the gap should be displayed as a time whereas if cases 2 or 3 are true and the difference in laps completed is greater than 1 the gap should be displayed as a number of laps.
The problems I'm having are:
Determining whether case 2 or 3 is true if the drivers are on different laps. I think the best way is to use their current node index (from the IS_NLP packet).
Determining the time gap if case 2 is true and the laps completed difference is 1. In this case I think you would just take the split time for the last completed split of the driver behind and subtract the split time at the same point of the player ahead on their last lap.
Am I on the right lines? Am I missing something obvious? Am I going insane with these questions?