Simple class to load and manage track data, track names and such.
More...
#include <track_manager.hpp>
|
static void | removeTrackSearchDirs () |
|
static void | addTrackSearchDir (const std::string &dir) |
| Adds a directory from which tracks are loaded. More...
|
|
|
typedef std::vector< Track * > | Tracks |
|
typedef std::map< std::string, std::vector< int > > | Group2Indices |
|
Simple class to load and manage track data, track names and such.
◆ TrackManager()
TrackManager::TrackManager |
( |
| ) |
|
Constructor (currently empty).
The real work happens in loadTrackList.
◆ addTrackSearchDir()
void TrackManager::addTrackSearchDir |
( |
const std::string & |
dir | ) |
|
|
static |
Adds a directory from which tracks are loaded.
The track manager checks if either this directory itself contains a track, and if any subdirectory contains a track.
- Parameters
-
◆ getAllArenaGroups()
const std::vector<std::string>& TrackManager::getAllArenaGroups |
( |
bool |
soccer_arena = false | ) |
const |
|
inline |
Returns a list of the names of all used arena groups.
◆ getAllTrackDirs()
const std::vector<std::string>* TrackManager::getAllTrackDirs |
( |
| ) |
const |
|
inline |
Returns a list of all directories that contain a track.
◆ getAllTrackGroups()
const std::vector<std::string>& TrackManager::getAllTrackGroups |
( |
| ) |
const |
|
inline |
Returns a list of the names of all used track groups.
◆ getAllTrackIdentifiers()
std::vector< std::string > TrackManager::getAllTrackIdentifiers |
( |
| ) |
|
Returns a list of all track identifiers.
Returns a list with all track identifiert.
◆ getArenasInGroup()
const std::vector<int>& TrackManager::getArenasInGroup |
( |
const std::string & |
g, |
|
|
bool |
soccer_arena = false |
|
) |
| |
|
inline |
Returns a list of all arenas in a given group.
- Parameters
-
◆ getNumberOfRaceTracks()
int TrackManager::getNumberOfRaceTracks |
( |
| ) |
const |
Returns the number of racing tracks.
Those are tracks that are not internal (like cut scenes), arenas, or soccer fields.
◆ getNumberOfTracks()
size_t TrackManager::getNumberOfTracks |
( |
| ) |
const |
|
inline |
Returns the number of tracks.
◆ getTrack() [1/2]
Track * TrackManager::getTrack |
( |
const std::string & |
ident | ) |
const |
Get TrackData by the track identifier.
- Parameters
-
ident | Identifier = basename of the directory the track is in. |
- Returns
- The corresponding track object, or NULL if not found
◆ getTrack() [2/2]
Track* TrackManager::getTrack |
( |
unsigned int |
index | ) |
const |
|
inline |
Returns the track with a given index number.
- Parameters
-
index | The index number of the track. |
◆ getTracksInGroup()
const std::vector<int>& TrackManager::getTracksInGroup |
( |
const std::string & |
g | ) |
|
|
inline |
Returns a list of all tracks in a given group.
- Parameters
-
◆ isAvailable()
bool TrackManager::isAvailable |
( |
unsigned int |
n | ) |
const |
|
inline |
Checks if a certain track is available.
- Parameters
-
n | Index of the track to check. |
◆ loadTrack()
bool TrackManager::loadTrack |
( |
const std::string & |
dirname | ) |
|
Tries to load a track from a single directory.
Returns true if a track was successfully loaded.
- Parameters
-
dirname | Name of the directory to load the track from. |
◆ loadTrackList()
void TrackManager::loadTrackList |
( |
| ) |
|
Load all .track files from all directories.
Loads all tracks from the track directory (data/track).
◆ removeAllCachedData()
void TrackManager::removeAllCachedData |
( |
| ) |
|
Removes all cached data from all tracks.
This is called when the screen resolution is changed and all textures need to be bound again.
◆ removeTrack()
void TrackManager::removeTrack |
( |
const std::string & |
ident | ) |
|
Removes a track.
- Parameters
-
ident | Identifier of the track (i.e. the name of the directory). |
◆ setUnavailableTracks()
void TrackManager::setUnavailableTracks |
( |
const std::vector< std::string > & |
tracks | ) |
|
Sets a list of track as being unavailable (e.g.
Sets all tracks that are not in the list a to be unavailable.
in network mode the track is not on all connected machines.
- Parameters
-
tracks | List of tracks to mark as unavilable. |
This is used by the network manager upon receiving the list of available tracks from a client.
- Parameters
-
tracks | List of all track identifiere (available on a client). |
◆ updateGroups()
void TrackManager::updateGroups |
( |
const Track * |
track | ) |
|
|
private |
Updates the groups after a track was read in.
- Parameters
-
track | Pointer to the new track, whose groups are now analysed. |
◆ m_all_track_dirs
std::vector<std::string> TrackManager::m_all_track_dirs |
|
private |
All directories in which tracks were found.
◆ m_arena_groups
Group2Indices TrackManager::m_arena_groups |
|
private |
List of all arena groups.
◆ m_soccer_arena_groups
Group2Indices TrackManager::m_soccer_arena_groups |
|
private |
List of all soccer arena groups.
◆ m_track_avail
std::vector<bool> TrackManager::m_track_avail |
|
private |
Flag if this track is available or not.
Tracks are set unavailable if they are not available on all clients (applies only to network mode)
◆ m_track_groups
Group2Indices TrackManager::m_track_groups |
|
private |
List of all racing track groups.
◆ m_track_search_path
std::vector< std::string > TrackManager::m_track_search_path |
|
staticprivate |
All directories in which tracks are searched.
◆ m_tracks
Tracks TrackManager::m_tracks |
|
private |
The documentation for this class was generated from the following files: