TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
racetrackselect.cpp File Reference

Helpers for selecting a valid race-manager track. More...

#include <stdio.h>
#include <string.h>
#include <tgf.h>
#include <track.h>
#include <raceman.h>
#include "racetrackselect.h"
Include dependency graph for racetrackselect.cpp:

Go to the source code of this file.

Functions

static bool reBuildTrackFileName (const char *category, const char *trackName, char *trackFile, int trackFileSize)
 Build the track XML path for a category/name pair.
bool ReTrackFileExists (const char *category, const char *trackName, char *trackFile, int trackFileSize)
 Check whether a track XML file exists and can be parsed.
std::vector< tReTrackCandidate > ReFindAvailableTracks (void)
 Find all available tracks under the current TORCS track search path.
bool ReResolveTrackSelection (void *params, int curTrackIndex, const std::vector< tReTrackCandidate > &availableTracks, tReTrackSelection *selection, bool updateParams)
 Resolve the current race-manager track entry to an available track.

Detailed Description

Helpers for selecting a valid race-manager track.

Definition in file racetrackselect.cpp.

Function Documentation

◆ reBuildTrackFileName()

bool reBuildTrackFileName ( const char * category,
const char * trackName,
char * trackFile,
int trackFileSize )
static

Build the track XML path for a category/name pair.

Parameters
[in]categoryTrack category directory name
[in]trackNameTrack directory and XML base name
[in,out]trackFileBuffer receiving the generated track XML path
[in]trackFileSizeSize of trackFile in bytes
Returns
true if the path was generated without truncation

Definition at line 54 of file racetrackselect.cpp.

◆ ReFindAvailableTracks()

std::vector< tReTrackCandidate > ReFindAvailableTracks ( void )

Find all available tracks under the current TORCS track search path.

Returns
Vector of selectable tracks whose XML files can be read

Definition at line 88 of file racetrackselect.cpp.

Here is the call graph for this function:

◆ ReResolveTrackSelection()

bool ReResolveTrackSelection ( void * params,
int curTrackIndex,
const std::vector< tReTrackCandidate > & availableTracks,
tReTrackSelection * selection,
bool updateParams )

Resolve the current race-manager track entry to an available track.

The configured track is kept when it is present in availableTracks. If it is missing, the first available track in the same category is preferred, otherwise the first available track is used. When updateParams is true, a fallback selection is written back to the current race-manager track section.

Parameters
[in,out]paramsRace-manager parameter handle
[in]curTrackIndexCurrent track section index under RM_SECT_TRACKS
[in]availableTracksOrdered list of valid track candidates
[in,out]selectionResolved track selection result
[in]updateParamstrue to write fallback category/name to params
Returns
true if a valid selection was found

Definition at line 125 of file racetrackselect.cpp.

Here is the call graph for this function:

◆ ReTrackFileExists()

bool ReTrackFileExists ( const char * category,
const char * trackName,
char * trackFile,
int trackFileSize )

Check whether a track XML file exists and can be parsed.

Parameters
[in]categoryTrack category directory name
[in]trackNameTrack directory and XML base name
[in,out]trackFileOptional buffer receiving the generated track XML path
[in]trackFileSizeSize of trackFile in bytes
Returns
true if the track XML exists and was read successfully

Definition at line 66 of file racetrackselect.cpp.

Here is the call graph for this function: