SuperTuxKart
|
This class contains the progression through challenges for the story mode. More...
#include <story_mode_status.hpp>
Public Member Functions | |
StoryModeStatus (const XMLNode *node=NULL) | |
void | computeActive (bool first_call=false) |
bool | isLocked (const std::string &feature) |
void | unlockFeatureByList () |
void | lockFeature (ChallengeStatus *challenge) |
void | unlockFeature (ChallengeStatus *c, RaceManager::Difficulty d, bool do_save=true) |
Unlocks a feature. | |
void | raceFinished () |
This is called when a race is finished. | |
void | grandPrixFinished () |
This is called when a GP is finished. | |
void | save (UTFWriter &out, bool current_player=false) |
Writes the data of this StoryModeStatus to the specified stream. | |
void | addStatus (ChallengeStatus *cs) |
Adds a ChallengeStatus with the specified id to the set of all statuses of this object. | |
void | setCurrentChallenge (const std::string &challenge_id) |
Set the current challenge (or NULL if no challenge is done). | |
const std::vector< const ChallengeData * > | getRecentlyCompletedChallenges () |
Returns the list of recently unlocked features (e.g. | |
void | clearUnlocked () |
Clear the list of recently unlocked challenges. | |
int | getNumCompletedChallenges () const |
Returns the number of completed challenges. | |
int | getNumReqMetInLowerDiff () const |
Returns the number of challenges with the superTux time beaten in a lower difficulty. | |
int | getPoints () const |
Returns the number of points accumulated. | |
int | getPointsBefore () const |
Returns the number of points before the previous point increase. | |
int | getNextUnlockPoints () const |
Returns the number of points needed by the next unlockable. | |
int | getNumEasyTrophies () const |
Returns the number of fulfilled challenges at easy level. | |
int | getNumMediumTrophies () const |
int | getNumHardTrophies () const |
Returns the number of fulfilled challenges at hard level. | |
int | getNumBestTrophies () const |
Returns the number of fulfilled challenges at best level. | |
void | setFirstTime (bool ft) |
Sets if this is the first time the intro is shown. | |
bool | isFirstTime () const |
Returns if this is the first time the intro is shown. | |
void | setFinished () |
Sets if the player has beaten Nolock. | |
bool | isFinished () const |
Returns if the player has beaten Nolock. | |
void | setSpeedrunFinished () |
Sets if the player has finished a valid speedrun. | |
bool | isSpeedrunFinished () const |
Returns if the player has finished a valid speedrun | |
void | setStoryModeTimer (int milliseconds) |
Sets the story mode timer. | |
int | getStoryModeTimer () |
Gets the story mode timer This is designed to be used on loading and once story mode is completed ; it will return out-of-date values when the timer is running. | |
void | setSpeedrunTimer (int milliseconds) |
Sets the story mode timer. | |
int | getSpeedrunTimer () |
Gets the speedrun timer This is designed to be used on loading and once story mode is completed ; it will return out-of-date values when the timer is running. | |
const ChallengeStatus * | getCurrentChallengeStatus () const |
const ChallengeStatus * | getChallengeStatus (const std::string &id) const |
Returns a challenge given the challenge id. | |
Private Attributes | |
std::map< std::string, bool > | m_locked_features |
Contains whether each feature of the challenge is locked or unlocked. | |
std::vector< const ChallengeData * > | m_unlocked_features |
Recently unlocked features (they are waiting here until they are shown to the user) | |
std::map< std::string, ChallengeStatus * > | m_challenges_state |
const ChallengeStatus * | m_current_challenge |
A pointer to the current challenge, or NULL if no challenge is active. | |
int | m_points |
int | m_points_before |
int | m_next_unlock_points |
bool | m_first_time |
Set to false after the initial stuff (intro, select kart, etc.) | |
int | m_easy_challenges |
int | m_medium_challenges |
int | m_hard_challenges |
int | m_best_challenges |
bool | m_story_mode_finished |
bool | m_valid_speedrun_finished |
int | m_story_mode_milliseconds |
int | m_speedrun_milliseconds |
This class contains the progression through challenges for the story mode.
It maintains a list of all challenges in a mapping of challenge id to an instance of ChallengeStatus. Each ChallengeStatus stores at which level a challenge was solved. This object also keeps track of the overall points a player has.
void StoryModeStatus::addStatus | ( | ChallengeStatus * | cs | ) |
Adds a ChallengeStatus with the specified id to the set of all statuses of this object.
cs | The challenge status. |
|
inline |
Returns the number of points needed by the next unlockable.
0 if none.
|
inline |
Returns the list of recently unlocked features (e.g.
call at the end of a race to know if any features were unlocked)
void StoryModeStatus::grandPrixFinished | ( | ) |
This is called when a GP is finished.
See if there is an active challenge that was fulfilled.
void StoryModeStatus::raceFinished | ( | ) |
This is called when a race is finished.
See if there is an active challenge that was fulfilled.
void StoryModeStatus::save | ( | UTFWriter & | out, |
bool | current_player = false |
||
) |
Writes the data of this StoryModeStatus to the specified stream.
out | UTF stream to write to. |
void StoryModeStatus::setCurrentChallenge | ( | const std::string & | challenge_id | ) |
Set the current challenge (or NULL if no challenge is done).
challenge | Pointer to the challenge (or NULL) |
void StoryModeStatus::unlockFeature | ( | ChallengeStatus * | c, |
RaceManager::Difficulty | d, | ||
bool | do_save = true |
||
) |
Unlocks a feature.
ComputeActive resets the locked feature list, so no special code is required in order to update m_locked_features.
c | The challenge that was fulfilled. |
d | Difficulty at which the challenge was solved. |
do_save | If true update the challenge file on disk. |