SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
UnlockManager Class Reference

main class to handle locking/challenges More...

#include <unlock_manager.hpp>

Inheritance diagram for UnlockManager:
Inheritance graph
[legend]

Public Member Functions

 ~UnlockManager ()
 Saves the challenge status.
 
void addOrFreeChallenge (ChallengeData *c)
 If a challenge is supported by this binary (i.e.
 
void addListChallenge (ChallengeData *c)
 Add a challenge to the unlock challenges list.
 
void addChallenge (const std::string &filename)
 Reads a challenge from the given filename.
 
const ChallengeDatagetChallengeData (const std::string &id)
 Returns the challenge data for a challenge id, or NULL if no such challenge exist.
 
bool isSupportedVersion (const ChallengeData &challenge)
 Test if the given challenge is supported by this binary.
 
void playLockSound () const
 Eye- (or rather ear-) candy.
 
void findWhatWasUnlocked (int pointsBefore, int pointsNow, std::vector< std::string > &tracks, std::vector< std::string > &gps, std::vector< std::string > &karts, std::vector< const ChallengeData * > &unlocked)
 This functions finds what new tracks, GP and karts have been unlocked.
 
bool unlockByPoints (int points, ChallengeStatus *unlock_list)
 This functions sets as completed the "challenges" requiring a certain number of points, to unlock features.
 
bool unlockSpecial (ChallengeStatus *unlock_list, int max_req_in_lower_diff)
 This functions sets as completed the "challenges" requiring some special conditions Returns true if the challenge has been completed.
 
StoryModeStatuscreateStoryModeStatus (const XMLNode *node=NULL)
 Creates a game slot.
 

Private Types

typedef std::map< std::string, ChallengeData * > AllChallengesType
 

Private Member Functions

void readAllChallengesInDirs (const std::vector< std::string > *all_dirs)
 

Private Attributes

SFXBasem_locked_sound
 
AllChallengesType m_all_challenges
 
AllChallengesType m_list_challenges
 

Detailed Description

main class to handle locking/challenges

Member Function Documentation

◆ addChallenge()

void UnlockManager::addChallenge ( const std::string &  filename)

Reads a challenge from the given filename.

The challenge will then either be stored, or (if the challenge version is not supported anymore, freed)

Parameters
filenameName of the challenge file to read.

◆ addListChallenge()

void UnlockManager::addListChallenge ( ChallengeData c)

Add a challenge to the unlock challenges list.

Parameters
cThe challenge that is either stored or freed.

◆ addOrFreeChallenge()

void UnlockManager::addOrFreeChallenge ( ChallengeData c)

If a challenge is supported by this binary (i.e.

has an appropriate challenge version number), add this challenge to the set of all challenges, otherwise free the memory for this challenge.

Parameters
cThe challenge that is either stored or freed.

◆ createStoryModeStatus()

StoryModeStatus * UnlockManager::createStoryModeStatus ( const XMLNode node = NULL)

Creates a game slot.

It initialises the game slot's status with the information in the xml node (if given), basically restoring the saved states for a player.

Parameters
nodeThe XML game-slots node with all data for a player.

◆ getChallengeData()

const ChallengeData * UnlockManager::getChallengeData ( const std::string &  id)

Returns the challenge data for a challenge id, or NULL if no such challenge exist.

Parameters
idId of the challenge.

◆ isSupportedVersion()

bool UnlockManager::isSupportedVersion ( const ChallengeData challenge)

Test if the given challenge is supported by this binary.

Parameters
challengeThe challenge to test.

◆ playLockSound()

void UnlockManager::playLockSound ( ) const

Eye- (or rather ear-) candy.

Play a sound when user tries to access a locked area

◆ unlockByPoints()

bool UnlockManager::unlockByPoints ( int  points,
ChallengeStatus unlock_list 
)

This functions sets as completed the "challenges" requiring a certain number of points, to unlock features.

Returns true if the challenge has been completed


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