The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: alassio | Created: 2017-04-21 10:15:29
Subject: How do I recognize an eliminated opponent?
Hi all
This may be a trivial question:
I try to collect some lap time statistics during the race including the opponent's lap times. Now if an opponent gets eliminated during a race (a highly unlikely event) due to running out of fuel or too much damage, how can this be recognized in the opponent's state?

Thanks, Rico
Last Edited: 2017-04-21 10:15:29 by alassio
    Author: firechief | Created: 2017-04-21 10:34:08
    Subject: Re: How do I recognize an eliminated opponent?
    if (car->_state & RM_CAR_STATE_NO_SIMU) {
    // car has been eliminated
    }
    Last Edited: 2017-04-21 10:34:08 by firechief
      Author: alassio | Created: 2017-04-23 09:32:43
      Subject: Re: How do I recognize an eliminated opponent?
      Thanks for the answer!
      However, this seems only to be half the truth, because while in pit this condition also applies. So one has to additionally exclude that state.

      Regards, Rico
      Last Edited: 2017-04-23 09:32:43 by alassio
        Author: firechief | Created: 2017-04-23 15:09:07
        Subject: Re: How do I recognize an eliminated opponent?
        Very true Rico. Let me revise my earlier code snippet:-

        if ((car->_state & RM_CAR_STATE_NO_SIMU) && !(car->_state & RM_CAR_STATE_PIT)) {
        // car has been eliminated
        }

        Hopefully that should do the trick?
        Last Edited: 2017-04-23 15:10:36 by firechief
          Author: alassio | Created: 2017-04-23 17:21:25
          Subject: Re: How do I recognize an eliminated opponent?
          Yes, found out about this after noticing strange behaviour after pitting ...
          Last Edited: 2017-04-23 17:21:25 by alassio