TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
Robot Setup Tools API

API to load and store car setups in a unified way, and to support setup changes during pit stops. More...

Collaboration diagram for Robot Setup Tools API:

Functions

void RtInitCarPitSetup (void *hdle, tCarPitSetup *s, bool minmaxonly)
 Initialize tCarPitSetup from data in parameter set given in handle hdle.
void RtGetCarPitSetupFilename (rtCarPitSetupType type, int robidx, const char *carname, const char *trackname, char *filename, const int len)
 Compose filename from given strings.
void RtSaveCarPitSetupFile (void *hdlecar, tCarPitSetup *s, const char *filepath, const char *carname)
 Save adjustable setup entries to a file, merging them with hdlecar's restrictions.
void RtSaveCarPitSetup (void *hdlecar, tCarPitSetup *s, rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname)
 Save a custom setup in the robot's local setups directory.
bool RtCarPitSetupExists (rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname)
 Checks if a specific car setup is available.
bool RtLoadCarPitSetupFilename (void *hdlecar, const char *filepath, tCarPitSetup *s, bool minmaxonly)
 Load a custom setup and merge its entries with hdlecar's restrictions.
bool RtLoadCarPitSetup (void *hdlecar, tCarPitSetup *s, rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname, bool minmaxonly)
 Load a custom setup from the robot's local setups directory.
void * RtLoadOriginalCarSettings (const char *carname)
 Gets a handle to a parameter file containing the original TORCS car setup, that means the car setup merged with the cars category setup.
bool RtInitCarPitSetupFromDefault (tCarPitSetup *s, const char *carname)
 Initialize the given tCarPitSetup with the original TORCS setup, that means the car setup merged with the cars category setup.
void * RtParmReadSetup (rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname)
 Load a custom car setup file for a given robot, car, track and session (race, practice, qualifying, ...) type.

Detailed Description

API to load and store car setups in a unified way, and to support setup changes during pit stops.

Function Documentation

◆ RtCarPitSetupExists()

bool RtCarPitSetupExists ( rtCarPitSetupType type,
const char * modulename,
int robidx,
const char * trackname,
const char * carname )

Checks if a specific car setup is available.

Parameters
[in]typeSetup type
[in]modulenameName of robot module without extension
[in]robidxIndex of robot
[in]tracknameTORCS internal name name of track
[in]carnameTORCS internal name car name
Returns
True if the local setup file can be opened for reading; false otherwise. Does not parse the file or validate its contents.

Definition at line 1028 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtGetCarPitSetupFilename()

void RtGetCarPitSetupFilename ( rtCarPitSetupType type,
int robidx,
const char * carname,
const char * trackname,
char * filename,
const int len )

Compose filename from given strings.

Parameters
[in]typeSetup type
[in]robidxIndex of robot
[in]carnameTORCS internal name car name
[in]tracknameTORCS internal name name of track
[out]filenameBuffer for car_track_index_session, without directory or extension.
[in]lenPositive buffer capacity in bytes including the terminator; a short buffer receives a truncated name. type must be a valid enum value.

Definition at line 848 of file rttrack.cpp.

◆ RtInitCarPitSetup()

void RtInitCarPitSetup ( void * hdle,
tCarPitSetup * s,
bool minmaxonly )

Initialize tCarPitSetup from data in parameter set given in handle hdle.

Parameters
[in]hdleHandle to setup parameter set
[in,out]sPointer to tCarPitSetup struct to initialize
[in]minmaxonlyIf true, preserve numeric values and update their bounds.
Note
Differential types are always updated, even with minmaxonly true. Missing numeric values become zero when minmaxonly is false; missing numeric boundaries leave the corresponding fields unchanged. Initialize s before use. All numeric values and boundaries are in SI units.

Definition at line 748 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtInitCarPitSetupFromDefault()

bool RtInitCarPitSetupFromDefault ( tCarPitSetup * s,
const char * carname )

Initialize the given tCarPitSetup with the original TORCS setup, that means the car setup merged with the cars category setup.

Parameters
[in,out]sPointer to tCarPitSetup struct to fill/initialize
[in]carnameTORCS internal name of the car (directory/filename)
Returns
True on success, false on failure

Definition at line 1172 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtLoadCarPitSetup()

bool RtLoadCarPitSetup ( void * hdlecar,
tCarPitSetup * s,
rtCarPitSetupType type,
const char * modulename,
int robidx,
const char * trackname,
const char * carname,
bool minmaxonly )

Load a custom setup from the robot's local setups directory.

Uses RtLoadCarPitSetupFilename with the standard filename.

Parameters
[in]hdlecarHandle to "master setup" (parameter set) to validate against (min/max and other checks)
[in,out]sPointer to tCarPitSetup struct to fill/initialize
[in]typeSetup type
[in]modulenameName of robot module without extension
[in]robidxIndex of robot
[in]tracknameTORCS internal name name of track
[in]carnameTORCS internal name car name
[in]minmaxonlyPreserve numeric values when true; bounds and differential types are still updated.
Returns
Result of RtLoadCarPitSetupFilename; false leaves s unchanged.
Note
Robot, car, track and session information are used to compose a standard setup filename
See also
RtLoadCarPitSetupFilename

Definition at line 1097 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtLoadCarPitSetupFilename()

bool RtLoadCarPitSetupFilename ( void * hdlecar,
const char * filepath,
tCarPitSetup * s,
bool minmaxonly )

Load a custom setup and merge its entries with hdlecar's restrictions.

Uses GfParmMergeHandles with DST: master-only entries are not added. Initialize s first, normally from RtInitCarPitSetupFromDefault; absent numeric bounds remain unchanged, while absent values become zero unless minmaxonly is true.

Parameters
[in]hdlecarHandle to "master setup" (parameter set) to validate against (min/max and other checks)
[in]filepathFull path to setup file
[in,out]sPointer to tCarPitSetup struct to fill/initialize
[in]minmaxonlyPreserve numeric values when true; bounds and differential types are still updated, as in RtInitCarPitSetup.
Returns
False if the file could not be read, leaving s unchanged; true after reading and applying it. This is not a comprehensive setup-validity check.

Definition at line 1067 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtLoadOriginalCarSettings()

void * RtLoadOriginalCarSettings ( const char * carname)

Gets a handle to a parameter file containing the original TORCS car setup, that means the car setup merged with the cars category setup.

Parameters
[in]carnameTORCS internal name of the car (directory/filename)
Returns
NULL on failure; otherwise an owned parameter handle. Release it with GfParmReleaseHandle when finished.

Definition at line 1127 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtParmReadSetup()

void * RtParmReadSetup ( rtCarPitSetupType type,
const char * modulename,
int robidx,
const char * trackname,
const char * carname )

Load a custom car setup file for a given robot, car, track and session (race, practice, qualifying, ...) type.

Parameters
[in]typeSetup type
[in]modulenameName of robot module without extension
[in]robidxIndex of robot
[in]tracknameTORCS internal name name of track
[in]carnameTORCS internal name car name
Returns
Handle to data, or NULL on failure (e.g. if file is not available). Release a successful result with GfParmReleaseHandle. This reads the saved file without merging it with the original car settings.
Note
Robot, car, track and session information are used to compose a standard setup filename

Definition at line 1198 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtSaveCarPitSetup()

void RtSaveCarPitSetup ( void * hdlecar,
tCarPitSetup * s,
rtCarPitSetupType type,
const char * modulename,
int robidx,
const char * trackname,
const char * carname )

Save a custom setup in the robot's local setups directory.

Creates the directory under GetLocalDir()/drivers/modulename/setups and calls RtSaveCarPitSetupFile. The void return does not report write success.

Parameters
[in]hdlecarHandle to "master setup" (parameter set) to validate against (min/max and other checks)
[in]sPointer to tCarPitSetup struct to save
[in]typeSetup type
[in]modulenameName of robot module without extension
[in]robidxIndex of robot
[in]tracknameTORCS internal name name of track
[in]carnameTORCS internal name car name
Note
Robot, car, track and session information are used to compose a standard setup filename
See also
RtSaveCarPitSetupFile

Definition at line 991 of file rttrack.cpp.

Here is the call graph for this function:

◆ RtSaveCarPitSetupFile()

void RtSaveCarPitSetupFile ( void * hdlecar,
tCarPitSetup * s,
const char * filepath,
const char * carname )

Save adjustable setup entries to a file, merging them with hdlecar's restrictions.

Numeric entries are written when abs(min-max) is at least 0.0001 in SI units; fixed entries are skipped. Existing file entries are retained unless replaced. Uses GfParmMergeHandles with DST, not a full validation pass. The void return does not report write success; the parent directory must already exist.

Parameters
[in]hdlecarHandle to "master setup" (parameter set) to validate against (min/max and other checks)
[in]sPointer to tCarPitSetup struct to save
[in]filepathFull path to setup file
[in]carnameTORCS internal name car name

Definition at line 888 of file rttrack.cpp.

Here is the call graph for this function: