20 #ifndef HEADER_GRAND_PRIX_DATA_HPP
21 #define HEADER_GRAND_PRIX_DATA_HPP
23 #include <irrString.h>
28 using irr::core::stringw;
94 GP_RANDOM_REVERSE = 2,
95 GP_DEFAULT_REVERSE = 3
102 #if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
103 # pragma warning(disable:4290)
113 m_reverse_type = GP_NO_REVERSE;
117 virtual std::vector<std::string>
getTrackNames(
const bool includeLocked=
false)
const;
121 const std::string& track_group);
125 const std::string& track_group,
127 bool new_tracks=
false);
130 void setId(
const std::string&
id);
131 void setName(
const irr::core::stringw& name);
141 std::vector<int>
getLaps(
const bool includeLocked=
false)
const;
142 std::vector<uint8_t>
getReverse(
const bool includeLocked=
false)
const;
144 const std::string& getTrackId(
const unsigned int track)
const;
145 irr::core::stringw
getTrackName(
const unsigned int track)
const;
146 bool containsUnavailableTracks()
const;
147 unsigned int getLaps(
const unsigned int track)
const;
148 bool getReverse(
const unsigned int track)
const;
149 void moveUp(
const unsigned int track);
150 void moveDown(
const unsigned int track);
151 void addTrack(
Track* track,
unsigned int laps,
152 bool reverse,
int position=-1);
153 void editTrack(
unsigned int index,
Track* track,
154 unsigned int laps,
bool reverse);
155 void remove(
const unsigned int track);
158 irr::core::stringw
getName()
const;
176 const {
return m_reverse_type; }
177 static const char* getRandomGPID() {
return "random"; }
178 static irr::core::stringw getRandomGPName();
179 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:37
irr::core::stringw m_name
The name of the grand prix.
Definition: grand_prix_data.hpp:57
std::string m_id
Internal name of the grand prix, not translated.
Definition: grand_prix_data.hpp:60
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:109
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:91
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:76
std::vector< uint8_t > getReverse(const bool includeLocked=false) const
Returns the reverse setting for each available grand prix.
Definition: grand_prix_data.cpp:479
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:42
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:166
bool m_editable
Wether the user can edit this grand prix or not.
Definition: grand_prix_data.hpp:73
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
const std::string & getFilename() const
Returns the filename of the grand prix xml file.
Definition: grand_prix_data.hpp:169
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:47
@ GP_ADDONS
Add-on GP.
Definition: grand_prix_data.hpp:51
@ GP_GROUP_COUNT
Number of groups.
Definition: grand_prix_data.hpp:52
@ GP_NONE
No group.
Definition: grand_prix_data.hpp:48
@ GP_USER_DEFINED
Created by the user.
Definition: grand_prix_data.hpp:50
@ GP_STANDARD
Standard GP, included with the game.
Definition: grand_prix_data.hpp:49
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
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
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
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:63
std::vector< int > m_laps
The number of laps that each track will be raced, in the right order.
Definition: grand_prix_data.hpp:66
const std::string & getId() const
Definition: grand_prix_data.hpp:162
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
std::vector< uint8_t > m_reversed
Whether the track in question should be done in reverse mode.
Definition: grand_prix_data.hpp:70
Definition: track.hpp:115
Declares the general types that are used by the network.