SuperTuxKart
Loading...
Searching...
No Matches
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.
 
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 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.
 
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.

◆ 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)

◆ grandPrixFinished()

void StoryModeStatus::grandPrixFinished ( )

This is called when a GP is finished.

See if there is an active challenge that was fulfilled.

◆ 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)

◆ 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.

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