SuperTuxKart
Public Member Functions | Private Attributes | List of all members
StoryModeStatus Class Reference

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. More...
 
void raceFinished ()
 This is called when a race is finished. More...
 
void grandPrixFinished ()
 This is called when a GP is finished. More...
 
void save (UTFWriter &out, bool current_player=false)
 Writes the data of this StoryModeStatus to the specified stream. More...
 
void addStatus (ChallengeStatus *cs)
 Adds a ChallengeStatus with the specified id to the set of all statuses of this object. More...
 
void setCurrentChallenge (const std::string &challenge_id)
 Set the current challenge (or NULL if no challenge is done). More...
 
const std::vector< const ChallengeData * > getRecentlyCompletedChallenges ()
 Returns the list of recently unlocked features (e.g. More...
 
void clearUnlocked ()
 Clear the list of recently unlocked challenges.
 
int getNumCompletedChallenges () const
 Returns the number of completed challenges. More...
 
int getNumReqMetInLowerDiff () const
 Returns the number of challenges with the superTux time beaten in a lower difficulty. More...
 
int getPoints () const
 Returns the number of points accumulated. More...
 
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. More...
 
int getNumEasyTrophies () const
 Returns the number of fulfilled challenges at easy level. More...
 
int getNumMediumTrophies () const
 
int getNumHardTrophies () const
 Returns the number of fulfilled challenges at hard level. More...
 
int getNumBestTrophies () const
 Returns the number of fulfilled challenges at best level. More...
 
void setFirstTime (bool ft)
 Sets if this is the first time the intro is shown. More...
 
bool isFirstTime () const
 Returns if this is the first time the intro is shown. More...
 
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. More...
 
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. More...
 
const ChallengeStatusgetCurrentChallengeStatus () const
 
const ChallengeStatusgetChallengeStatus (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 ChallengeStatusm_current_challenge
 A pointer to the current challenge, or NULL if no challenge is active. More...
 
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
 

Detailed Description

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.

Member Function Documentation

◆ addStatus()

void StoryModeStatus::addStatus ( ChallengeStatus cs)

Adds a ChallengeStatus with the specified id to the set of all statuses of this object.

Parameters
csThe challenge status.

◆ getNextUnlockPoints()

int StoryModeStatus::getNextUnlockPoints ( ) const
inline

Returns the number of points needed by the next unlockable.

0 if none.

◆ getNumBestTrophies()

int StoryModeStatus::getNumBestTrophies ( ) const
inline

Returns the number of fulfilled challenges at best level.

◆ getNumCompletedChallenges()

int StoryModeStatus::getNumCompletedChallenges ( ) const
inline

Returns the number of completed challenges.

◆ getNumEasyTrophies()

int StoryModeStatus::getNumEasyTrophies ( ) const
inline

Returns the number of fulfilled challenges at easy level.

◆ getNumHardTrophies()

int StoryModeStatus::getNumHardTrophies ( ) const
inline

Returns the number of fulfilled challenges at hard level.

◆ getNumReqMetInLowerDiff()

int StoryModeStatus::getNumReqMetInLowerDiff ( ) const

Returns the number of challenges with the superTux time beaten in a lower difficulty.

◆ getPoints()

int StoryModeStatus::getPoints ( ) const
inline

Returns the number of points accumulated.

◆ getRecentlyCompletedChallenges()

const std::vector<const ChallengeData*> StoryModeStatus::getRecentlyCompletedChallenges ( )
inline

Returns the list of recently unlocked features (e.g.

call at the end of a race to know if any features were unlocked)

◆ getSpeedrunTimer()

int StoryModeStatus::getSpeedrunTimer ( )
inline

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.

◆ getStoryModeTimer()

int StoryModeStatus::getStoryModeTimer ( )
inline

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.

◆ grandPrixFinished()

void StoryModeStatus::grandPrixFinished ( )

This is called when a GP is finished.

See if there is an active challenge that was fulfilled.

◆ isFirstTime()

bool StoryModeStatus::isFirstTime ( ) const
inline

Returns if this is the first time the intro is shown.

◆ raceFinished()

void StoryModeStatus::raceFinished ( )

This is called when a race is finished.

See if there is an active challenge that was fulfilled.

◆ save()

void StoryModeStatus::save ( UTFWriter out,
bool  current_player = false 
)

Writes the data of this StoryModeStatus to the specified stream.

Parameters
outUTF stream to write to.

◆ setCurrentChallenge()

void StoryModeStatus::setCurrentChallenge ( const std::string &  challenge_id)

Set the current challenge (or NULL if no challenge is done).

Parameters
challengePointer to the challenge (or NULL)

◆ setFirstTime()

void StoryModeStatus::setFirstTime ( bool  ft)
inline

Sets if this is the first time the intro is shown.

◆ unlockFeature()

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.

Parameters
cThe challenge that was fulfilled.
dDifficulty at which the challenge was solved.
do_saveIf true update the challenge file on disk.

Member Data Documentation

◆ m_current_challenge

const ChallengeStatus* StoryModeStatus::m_current_challenge
private

A pointer to the current challenge, or NULL if no challenge is active.


The documentation for this class was generated from the following files: