SuperTuxKart
|
the description of one challenge More...
#include <challenge_data.hpp>
Classes | |
class | UnlockableFeature |
Public Types | |
enum | RewardType { UNLOCK_TRACK , UNLOCK_GP , UNLOCK_MODE , UNLOCK_KART , UNLOCK_DIFFICULTY } |
The type of reward you get when fulfilling this challenge. | |
enum | GPLevel { GP_NONE , GP_EASY , GP_MEDIUM , GP_HARD , GP_BEST } |
The level of completion of a GP challenge. | |
enum | ChallengeModeType { CM_GRAND_PRIX , CM_SINGLE_RACE , CM_ANY } |
The various types of challenges that we support, which esp. More... | |
enum | SpecialUnlockType { SPECIAL_NONE , SPECIAL_MAX_REQ_IN_LOWER_DIFF } |
The type of value stored by m_unlock_special_value. | |
Public Member Functions | |
ChallengeData (const std::string &filename) | |
void | setRace (RaceManager::Difficulty d) const |
sets the right parameters in RaceManager to try this challenge | |
virtual void | check () const |
Checks if this challenge is valid, i.e. | |
virtual bool | isChallengeFulfilled (bool check_best=false) const |
Returns true if this (non-GP) challenge is fulfilled. | |
virtual GPLevel | isGPFulfilled () const |
Returns true if this GP challenge is fulfilled. | |
void | addUnlockTrackReward (const std::string &track_name) |
Sets that the given track will be unlocked if this challenge is unlocked. | |
void | addUnlockModeReward (const std::string &internal_mode_name, const irr::core::stringw &user_mode_name) |
void | addUnlockGPReward (const std::string &gp_name) |
void | addUnlockDifficultyReward (const std::string &internal_name, const irr::core::stringw &user_name) |
void | addUnlockKartReward (const std::string &internal_name, const irr::core::stringw &user_name) |
int | getVersion () const |
Returns the version number of this challenge. | |
const std::vector< UnlockableFeature > & | getFeatures () const |
Returns the list of unlockable features for this challenge. | |
const std::string & | getChallengeId () const |
Returns the id of the challenge. | |
void | setChallengeId (const std::string &s) |
Sets the id of this challenge. | |
const std::string & | getTrackId () const |
Returns the track associated with this challenge. | |
const std::string & | getGPId () const |
Returns the id of the grand prix associated with this challenge. | |
int | getNumLaps () const |
Return number of laps. | |
bool | getReverse () const |
Return reverse mode. | |
int | getNumTrophies () const |
Get number of required trophies to start this challenge. | |
int | getNumChallenges () const |
Get number of required completed challenges to start this challenge. | |
bool | isGrandPrix () const |
Returns if this challenge is a grand prix. | |
bool | isSingleRace () const |
Returns if this challenge is a grand prix. | |
bool | isGhostReplay () const |
Returns if this challenge is using ghost replay. | |
bool | isUnlockList () const |
Returns if this challenge is an unlock list. | |
SpecialUnlockType | getSpecialType () const |
Returns the special unlock list value. | |
int | getSpecialValue () const |
Returns the special unlock list value. | |
ChallengeModeType | getMode () const |
Returns the challenge mode of this challenge. | |
RaceManager::MinorRaceModeType | getMinorMode () const |
Returns the minor mode of this challenge. | |
const irr::core::stringw | getChallengeDescription () const |
Returns the description of this challenge. | |
int | getMaxPosition (RaceManager::Difficulty difficulty) const |
Returns the maximum position the player must have in order to win. | |
int | getNumKarts (RaceManager::Difficulty difficulty) const |
Returns the number of karts to use. | |
float | getTimeRequirement (RaceManager::Difficulty difficulty) const |
Returns the maximum time in which the kart must finish. | |
int | getEnergy (RaceManager::Difficulty difficulty) const |
Return the energy that a kart must at least have at the end of a race. | |
const std::string & | getAIKartIdent (RaceManager::Difficulty difficulty) const |
Returns the name of the AI to use (used for boss challenge). | |
Private Member Functions | |
void | setUnlocks (const std::string &id, ChallengeData::RewardType reward) |
Adds all rewards for fulfilling this challenge. | |
void | error (const char *id) const |
Private Attributes | |
ChallengeModeType | m_mode |
The challenge mode of this challenge. | |
RaceManager::MinorRaceModeType | m_minor |
The minor type, used when m_mode is CM_GP or CM_RACE only. | |
int | m_num_laps |
bool | m_reverse |
int | m_position [RaceManager::DIFFICULTY_COUNT] |
int | m_default_num_karts [RaceManager::DIFFICULTY_COUNT] |
std::string | m_ai_kart_ident [RaceManager::DIFFICULTY_COUNT] |
std::string | m_replay_files [RaceManager::DIFFICULTY_COUNT] |
float | m_time [RaceManager::DIFFICULTY_COUNT] |
int | m_energy [RaceManager::DIFFICULTY_COUNT] |
RaceManager::AISuperPower | m_ai_superpower [RaceManager::DIFFICULTY_COUNT] |
std::string | m_gp_id |
std::string | m_track_id |
std::string | m_filename |
int | m_version |
Version number of the challenge. | |
bool | m_is_unlock_list |
bool | m_is_ghost_replay |
std::string | m_id |
Short, internal name for this challenge. | |
std::vector< UnlockableFeature > | m_feature |
Features to unlock. | |
int | m_num_trophies |
Number of trophies required to access this challenge. | |
int | m_num_completed_challenges |
Number of completed challenges required to access this challenge (esp. | |
SpecialUnlockType | m_unlock_special_type |
Variables only used by unlock lists. | |
int | m_unlock_special_value |
the description of one challenge
The various types of challenges that we support, which esp.
determine when a challenge is tested if it is fulfilled. For now we have GP (a GP challenge, tested at the end of a GP), Race (tested at the end of a challenge race), and 'any', which is checked at the end of each race (maybe even non challenged once). An example for 'any' is 'are all challenges unclocked on highest level', which needs to be tested after each race (but is itself not a race mode, so it's not that you can start this challenge, which differentiates it from a race challenge).
void ChallengeData::addUnlockTrackReward | ( | const std::string & | track_name | ) |
Sets that the given track will be unlocked if this challenge is unlocked.
track_name | Name of the track to unlock. |
|
virtual |
Checks if this challenge is valid, i.e.
contains a valid track or a valid GP. If incorrect data are found, STK is aborted with an error message. (otherwise STK aborts when trying to do this challenge, which is worse).
|
virtual |
Returns true if this (non-GP) challenge is fulfilled.
check_best | : if true, check if the requirement for the best difficulty are met at a lower one. (requires SuperTux challenges to have a time รน requirement to make sense) |
|
private |
Adds all rewards for fulfilling this challenge.
id | Name of track or gp or kart or mode or difficulty reward. |
reward | Type of reward (track, gp, mode, difficulty, kart). |
|
private |
Number of completed challenges required to access this challenge (esp.
useful for the final challenge)