The online racing simulator
To detect if all have finished
(4 posts, started )
To detect if all have finished
Sorry if this have been asked/handled already...

Does anybody have a 100% sure way to detect that everybody in the race has finished? I mean those who are going to get a place in finishing table.

This is bit tricky I guess. You cannot compare players in race and finished in IS_STA, because the player count is the number currently on track. If a player who has finished spectates, the player count is reduced by 1, and it is increased by 1 if a new joins. That is not related to if racing is in progress or not (finished) or if the added/removed player is such that he could have finished.

If there is no such way, maybe it should be added? Maybe a new packet telling that the last player who can get a place in finishing table (has started before the 1st player finishes the race) has finished. Adding a count (etc) to IS_FIN packet (telling number of racers) doesn't help because somebody could spectate/pit before the end and never finishing. Same problem with a new confirmation flag (e.g. CONF_LAST_PLAYER) for IS_RES.

This could be used for qualifying too (time ended and nobody can improve time anymore).

This would be nice as I wanted my program to do something immediately and only after everybody has finished.
I don't really have that info in LFS, well not any more than you do.

How about making a list of who's on the track (a list of PLIDs) as soon as you get the first FIN packet, then strike people off that list when they FIN / pit / spectate.

When you have no more in the list you know that all valid finishers have finished. Would that work?
Yes, I guess it would. That's pretty much the same I was thinking but I considered it too messy (=not 'nice') if there was some simple direct way. So I decided to ask before. I suppose I have to do it in that way now

Thanks anyway.
That's what I basically did. Well at the start of the race I requested a TINY_NPL, to get all players, then I stored them in a list. I then kept track or whenever a player joined or left the race, and updated the list accordingly. Then I would count the number of drivers in this list to find out how many results to expect at the end.

To detect if all have finished
(4 posts, started )
FGED GREDG RDFGDR GSFDG