19#ifndef HEADER_TRACK_MANAGER_HPP
20#define HEADER_TRACK_MANAGER_HPP
41 typedef std::vector<Track*> Tracks;
46 typedef std::map<std::string, std::vector<int> > Group2Indices;
75 static void removeTrackSearchDirs();
83 bool loadTrack(
const std::string& dirname);
106 const std::vector<std::string>&
119 int getTrackIndexByIdent(
const std::string& ident)
const;
134 const std::vector<int>&
140 void onDemandLoadTrackScreenshots();
142 void updateScreenshotCache();
Simple class to load and manage track data, track names and such.
Definition: track_manager.hpp:33
std::vector< std::string > m_all_track_dirs
All directories in which tracks were found.
Definition: track_manager.hpp:39
~TrackManager()
Delete all tracks.
Definition: track_manager.cpp:51
std::vector< std::string > m_soccer_arena_group_names
List of the names of all groups containing soccer arenas.
Definition: track_manager.hpp:63
std::vector< std::string > getAllTrackIdentifiers()
Returns a list of all track identifiers.
Definition: track_manager.cpp:138
Track * getTrack(const std::string &ident) const
Get TrackData by the track identifier.
Definition: track_manager.cpp:92
const std::vector< std::string > * getAllTrackDirs() const
Returns a list of all directories that contain a track.
Definition: track_manager.hpp:94
std::vector< bool > m_track_avail
Flag if this track is available or not.
Definition: track_manager.hpp:68
TrackManager()
Constructor (currently empty).
Definition: track_manager.cpp:45
std::vector< std::string > m_track_group_names
List of the names of all groups containing tracks.
Definition: track_manager.hpp:57
void setUnavailableTracks(const std::vector< std::string > &tracks)
Sets a list of track as being unavailable (e.g.
Definition: track_manager.cpp:119
Tracks m_tracks
All track objects.
Definition: track_manager.hpp:44
void updateGroups(const Track *track)
Updates the groups after a track was read in.
Definition: track_manager.cpp:311
Group2Indices m_track_groups
List of all racing track groups.
Definition: track_manager.hpp:48
Group2Indices m_arena_groups
List of all arena groups.
Definition: track_manager.hpp:51
void removeTrack(const std::string &ident)
Removes a track.
Definition: track_manager.cpp:237
void removeAllCachedData()
Removes all cached data from all tracks.
Definition: track_manager.cpp:108
const std::vector< std::string > & getAllTrackGroups() const
Returns a list of the names of all used track groups.
Definition: track_manager.hpp:100
const std::vector< std::string > & getAllArenaGroups(bool soccer_arena=false) const
Returns a list of the names of all used arena groups.
Definition: track_manager.hpp:107
std::vector< std::string > m_arena_group_names
List of the names of all groups containing arenas.
Definition: track_manager.hpp:60
size_t getNumberOfTracks() const
Returns the number of tracks.
Definition: track_manager.hpp:113
const std::vector< int > & getTracksInGroup(const std::string &g)
Returns a list of all tracks in a given group.
Definition: track_manager.hpp:127
const std::vector< int > & getArenasInGroup(const std::string &g, bool soccer_arena=false)
Returns a list of all arenas in a given group.
Definition: track_manager.hpp:135
bool loadTrack(const std::string &dirname)
Tries to load a track from a single directory.
Definition: track_manager.cpp:195
Group2Indices m_soccer_arena_groups
List of all soccer arena groups.
Definition: track_manager.hpp:54
bool isAvailable(unsigned int n) const
Checks if a certain track is available.
Definition: track_manager.hpp:123
Track * getTrack(unsigned int index) const
Returns the track with a given index number.
Definition: track_manager.hpp:117
int getNumberOfRaceTracks() const
Returns the number of racing tracks.
Definition: track_manager.cpp:78
void loadTrackList()
Load all .track files from all directories.
Definition: track_manager.cpp:151
static std::vector< std::string > m_track_search_path
All directories in which tracks are searched.
Definition: track_manager.hpp:36
static void addTrackSearchDir(const std::string &dir)
Adds a directory from which tracks are loaded.
Definition: track_manager.cpp:69
Definition: track.hpp:114