20#ifndef HEADER_GRAND_PRIX_DATA_HPP
21#define HEADER_GRAND_PRIX_DATA_HPP
27using irr::core::stringw;
92 GP_RANDOM_REVERSE = 2,
93 GP_DEFAULT_REVERSE = 3
100#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
101# pragma warning(disable:4290)
111 m_reverse_type = GP_NO_REVERSE;
115 virtual std::vector<std::string>
getTrackNames(
const bool includeLocked=
false)
const;
119 const std::string& track_group);
123 const std::string& track_group,
125 bool new_tracks=
false);
128 void setId(
const std::string&
id);
129 void setName(
const irr::core::stringw& name);
139 std::vector<int>
getLaps(
const bool includeLocked=
false)
const;
140 std::vector<bool>
getReverse(
const bool includeLocked=
false)
const;
142 const std::string& getTrackId(
const unsigned int track)
const;
143 irr::core::stringw
getTrackName(
const unsigned int track)
const;
144 bool containsUnavailableTracks()
const;
145 unsigned int getLaps(
const unsigned int track)
const;
146 bool getReverse(
const unsigned int track)
const;
147 void moveUp(
const unsigned int track);
148 void moveDown(
const unsigned int track);
149 void addTrack(
Track* track,
unsigned int laps,
150 bool reverse,
int position=-1);
151 void editTrack(
unsigned int index,
Track* track,
152 unsigned int laps,
bool reverse);
153 void remove(
const unsigned int track);
156 irr::core::stringw
getName()
const;
174 const {
return m_reverse_type; }
175 static const char* getRandomGPID() {
return "random"; }
176 static irr::core::stringw getRandomGPName();
177 static irr::core::stringw reverseTypeToString(
GPReverseType reverse_type);
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:36
irr::core::stringw m_name
The name of the grand prix.
Definition: grand_prix_data.hpp:56
std::string m_id
Internal name of the grand prix, not translated.
Definition: grand_prix_data.hpp:59
bool writeToFile()
Saves the grand prix data to a file.
Definition: grand_prix_data.cpp:362
GrandPrixData()
Needed for simple creation of an instance of GrandPrixData.
Definition: grand_prix_data.hpp:107
std::vector< int > getLaps(const bool includeLocked=false) const
Returns the laps for each available track of the grand prix.
Definition: grand_prix_data.cpp:464
bool isEditable() const
Returns true if this grand prix can be edited.
Definition: grand_prix_data.cpp:492
GPReverseType
Used to define the reverse setting when creating a random GP: No reverse, all reverse (if available o...
Definition: grand_prix_data.hpp:89
void createRandomGP(const unsigned int number_of_tracks, const std::string &track_group, const GPReverseType use_reverse, bool new_tracks=false)
Creates a random grand prix from the specified parameters.
Definition: grand_prix_data.cpp:65
enum GPGroupType m_group
Group to which this GP belongs.
Definition: grand_prix_data.hpp:74
std::vector< std::string > m_tracks
The ident of the tracks in this grand prix in their right order, ident means the filename of the ....
Definition: grand_prix_data.hpp:41
irr::core::stringw getName() const
Definition: grand_prix_data.cpp:629
bool isRandomGP() const
Returns true if this GP is a random GP.
Definition: grand_prix_data.hpp:164
bool m_editable
Wether the user can edit this grand prix or not.
Definition: grand_prix_data.hpp:71
virtual std::vector< std::string > getTrackNames(const bool includeLocked=false) const
Returns the list of tracks that is available (i.e.
Definition: grand_prix_data.cpp:448
void setId(const std::string &id)
Sets the id of this grand prix.
Definition: grand_prix_data.cpp:206
GPGroupType
Used to classify GPs into groups.
Definition: grand_prix_data.hpp:46
@ GP_ADDONS
Add-on GP.
Definition: grand_prix_data.hpp:50
@ GP_GROUP_COUNT
Number of groups.
Definition: grand_prix_data.hpp:51
@ GP_NONE
No group.
Definition: grand_prix_data.hpp:47
@ GP_USER_DEFINED
Created by the user.
Definition: grand_prix_data.hpp:49
@ GP_STANDARD
Standard GP, included with the game.
Definition: grand_prix_data.hpp:48
void setFilename(const std::string &filename)
Sets the filename of this grand prix.
Definition: grand_prix_data.cpp:224
bool checkConsistency(bool log_error=true) const
Checks if the grand prix data are consistent.
Definition: grand_prix_data.cpp:401
const std::string & getFilename() const
Returns the filename of the grand prix xml file.
Definition: grand_prix_data.hpp:167
void reload()
Load the grand prix from the file set by the constructor or the grand prix editor.
Definition: grand_prix_data.cpp:250
void changeTrackNumber(const unsigned int number_of_tracks, const std::string &track_group)
Either adds or removes tracks to get the requested numder of tracks in a random GP.
Definition: grand_prix_data.cpp:97
std::vector< bool > getReverse(const bool includeLocked=false) const
Returns the reverse setting for each available grand prix.
Definition: grand_prix_data.cpp:479
void setGroup(const enum GPGroupType group)
Sets the group of this grand prix.
Definition: grand_prix_data.cpp:242
void setEditable(const bool editable)
Sets if this grand prix can be edited.
Definition: grand_prix_data.cpp:233
virtual unsigned int getNumberOfTracks(const bool includeLocked=false) const
Returns the number of tracks in this grand prix.
Definition: grand_prix_data.cpp:501
std::vector< bool > m_reversed
Whether the track in question should be done in reverse mode.
Definition: grand_prix_data.hpp:68
void setName(const irr::core::stringw &name)
Sets the name of the grand prix.
Definition: grand_prix_data.cpp:215
irr::core::stringw getTrackName(const unsigned int track) const
Returns the (translated) name of the track with the specified index.
Definition: grand_prix_data.cpp:512
void changeReverse(const GPReverseType use_reverse)
Updates the GP data with newly decided reverse requirements.
Definition: grand_prix_data.cpp:179
std::string m_filename
Original filename, only for error handling needed.
Definition: grand_prix_data.hpp:62
const std::string & getId() const
Definition: grand_prix_data.hpp:160
std::vector< int > m_laps
The number of laps that each track will be raced, in the right order.
Definition: grand_prix_data.hpp:65
bool isTrackAvailable(const std::string &id, bool includeLocked) const
In the last GP Fort Magma can not be used untill the final challenge.
Definition: grand_prix_data.cpp:430
Definition: track.hpp:114