Emergency 20 Dokumentation  4.2.0
em5::PlayerProgress Class Reference

EMERGENCY 5 player progress class. More...

#include <PlayerProgress.h>

Inheritance diagram for em5::PlayerProgress:

Classes

struct  WorldEventProgress
 

Public Types

enum  MedalType { MEDAL_NONE, MEDAL_BRONZE, MEDAL_SILVER, MEDAL_GOLD }
 
typedef boost::container::flat_set< qsf::NamedIdentifierNameSet
 
typedef std::map< qsf::NamedIdentifier, WorldEventProgressWorldEventProgressMap
 
typedef std::pair< const qsf::NamedIdentifier, MedalTypeMedal
 
typedef std::map< qsf::NamedIdentifier, MedalTypeMedalMap
 

Public Member Functions

 PlayerProgress ()
 Default constructor. More...
 
virtual ~PlayerProgress ()
 Destructor. More...
 
void resetProgress (bool clearAchievementsAndMedals)
 Reset the current player progress to initial state. More...
 
uint32 getTotalScore () const
 Return the current total score. More...
 
void setTotalScore (uint32 totalScore)
 Sets total score. More...
 
void addPointsToTotalScore (uint32 points)
 Adds points to the total score. More...
 
bool isTutorialPlayed () const
 Return whether or not the tutorial is considered to have been played. More...
 
void setTutorialPlayed (bool unlock)
 Set whether or not the tutorial is considered to have been played (freeplay and multiplay is unlocked in this case) More...
 
bool isMapUnlocked (const MapIdentifier &mapIdentifier) const
 Check if a map is unlocked. More...
 
bool isMainEventUnlocked (const MainEventIdentifier &mainEventIdentifier) const
 Check if a main event is unlocked. More...
 
bool isMainEventWonInCampaign (const MainEventIdentifier &mainEventIdentifier) const
 Check if a main event is won in campaign. More...
 
void setMapUnlocked (const MapIdentifier &mapIdentifier)
 Unlock the given map. More...
 
void setMainEventUnlocked (const MainEventIdentifier &mainEventIdentifier)
 Unlock the given main event. More...
 
void setMainEventWonInCampaign (const MainEventIdentifier &mainEventIdentifier)
 Unlock the given main event. More...
 
bool isWorldEventWonMunich (const qsf::NamedIdentifier &eventIdentifier) const
 Check if world event is won. More...
 
bool isWorldEventWonHamburg (const qsf::NamedIdentifier &eventIdentifier) const
 
bool isWorldEventWonBerlin (const qsf::NamedIdentifier &eventIdentifier) const
 
void setWorldEventWonMunich (const qsf::NamedIdentifier &eventIdentifier)
 Set world event won. More...
 
void setWorldEventWonHamburg (const qsf::NamedIdentifier &eventIdentifier)
 
void setWorldEventWonBerlin (const qsf::NamedIdentifier &eventIdentifier)
 
uint16 getWorldEventsWonMunich () const
 Get number of world events won. More...
 
uint16 getWorldEventsWonHamburg () const
 
uint16 getWorldEventsWonBerlin () const
 
WorldEventProgressgetWorldEventProgress (const MapIdentifier &mapIdentifier)
 Get the world event progress for a given map. More...
 
bool wasCampaignStarted (uint32 campaignIndex) const
 Check if a certain campaign was started at least once. More...
 
bool wereAllCampaignsStarted () const
 Check if all campaigns were started at least once. More...
 
void setCampaignStarted (uint32 campaignIndex, bool started=true)
 Set campaign started flag. More...
 
HighscoreManagergetHighscoreManager ()
 Get the highscore manager. More...
 
void unlockMedal (const qsf::NamedIdentifier &medalIdentifier, MedalType medalType)
 Unlock the specified medal. More...
 
void unlockAchievementsOnMedal ()
 Triggers an achievement if all needed medals are unlocked. More...
 
const MedalgetMedal (const qsf::StringHash &medalIdentifier) const
 
const MedalMapgetMedalMap () const
 
bool isCampaignComplete (uint32 campaignIndex=0) const
 
bool isFixedEventPoolCompleted (const MapIdentifier &mapIdentifier) const
 
void setFixedEventPoolCompleted (const MapIdentifier &mapIdentifier, bool completed=true)
 
void serialize (qsf::BinarySerializer &serializer)
 Serialization of the player progress. More...
 

Static Public Attributes

static const char LOCAL_PLAYER []
 

Protected Member Functions

bool loadProgress (const std::string &screenName)
 Load player progress from disk ("" = local player) More...
 
bool saveProgress (const std::string &screenName)
 Save player progress to disk ("" = local player) More...
 

Detailed Description

EMERGENCY 5 player progress class.

Member Typedef Documentation

typedef boost::container::flat_set<qsf::NamedIdentifier> em5::PlayerProgress::NameSet

Member Enumeration Documentation

Enumerator
MEDAL_NONE 
MEDAL_BRONZE 
MEDAL_SILVER 
MEDAL_GOLD 

Constructor & Destructor Documentation

em5::PlayerProgress::PlayerProgress ( )

Default constructor.

virtual em5::PlayerProgress::~PlayerProgress ( )
virtual

Destructor.

Member Function Documentation

void em5::PlayerProgress::addPointsToTotalScore ( uint32  points)

Adds points to the total score.

HighscoreManager& em5::PlayerProgress::getHighscoreManager ( )

Get the highscore manager.

const Medal* em5::PlayerProgress::getMedal ( const qsf::StringHash medalIdentifier) const
const MedalMap& em5::PlayerProgress::getMedalMap ( ) const
uint32 em5::PlayerProgress::getTotalScore ( ) const

Return the current total score.

WorldEventProgress& em5::PlayerProgress::getWorldEventProgress ( const MapIdentifier mapIdentifier)

Get the world event progress for a given map.

uint16 em5::PlayerProgress::getWorldEventsWonBerlin ( ) const
uint16 em5::PlayerProgress::getWorldEventsWonHamburg ( ) const
uint16 em5::PlayerProgress::getWorldEventsWonMunich ( ) const

Get number of world events won.

bool em5::PlayerProgress::isCampaignComplete ( uint32  campaignIndex = 0) const
bool em5::PlayerProgress::isFixedEventPoolCompleted ( const MapIdentifier mapIdentifier) const
bool em5::PlayerProgress::isMainEventUnlocked ( const MainEventIdentifier mainEventIdentifier) const

Check if a main event is unlocked.

bool em5::PlayerProgress::isMainEventWonInCampaign ( const MainEventIdentifier mainEventIdentifier) const

Check if a main event is won in campaign.

bool em5::PlayerProgress::isMapUnlocked ( const MapIdentifier mapIdentifier) const

Check if a map is unlocked.

bool em5::PlayerProgress::isTutorialPlayed ( ) const

Return whether or not the tutorial is considered to have been played.

bool em5::PlayerProgress::isWorldEventWonBerlin ( const qsf::NamedIdentifier eventIdentifier) const
bool em5::PlayerProgress::isWorldEventWonHamburg ( const qsf::NamedIdentifier eventIdentifier) const
bool em5::PlayerProgress::isWorldEventWonMunich ( const qsf::NamedIdentifier eventIdentifier) const

Check if world event is won.

bool em5::PlayerProgress::loadProgress ( const std::string &  screenName)
protected

Load player progress from disk ("" = local player)

void em5::PlayerProgress::resetProgress ( bool  clearAchievementsAndMedals)

Reset the current player progress to initial state.

bool em5::PlayerProgress::saveProgress ( const std::string &  screenName)
protected

Save player progress to disk ("" = local player)

void em5::PlayerProgress::serialize ( qsf::BinarySerializer serializer)

Serialization of the player progress.

Exceptions
Throws"std::exception" in case on an error
void em5::PlayerProgress::setCampaignStarted ( uint32  campaignIndex,
bool  started = true 
)

Set campaign started flag.

void em5::PlayerProgress::setFixedEventPoolCompleted ( const MapIdentifier mapIdentifier,
bool  completed = true 
)
void em5::PlayerProgress::setMainEventUnlocked ( const MainEventIdentifier mainEventIdentifier)

Unlock the given main event.

void em5::PlayerProgress::setMainEventWonInCampaign ( const MainEventIdentifier mainEventIdentifier)

Unlock the given main event.

void em5::PlayerProgress::setMapUnlocked ( const MapIdentifier mapIdentifier)

Unlock the given map.

void em5::PlayerProgress::setTotalScore ( uint32  totalScore)

Sets total score.

void em5::PlayerProgress::setTutorialPlayed ( bool  unlock)

Set whether or not the tutorial is considered to have been played (freeplay and multiplay is unlocked in this case)

void em5::PlayerProgress::setWorldEventWonBerlin ( const qsf::NamedIdentifier eventIdentifier)
void em5::PlayerProgress::setWorldEventWonHamburg ( const qsf::NamedIdentifier eventIdentifier)
void em5::PlayerProgress::setWorldEventWonMunich ( const qsf::NamedIdentifier eventIdentifier)

Set world event won.

void em5::PlayerProgress::unlockAchievementsOnMedal ( )

Triggers an achievement if all needed medals are unlocked.

Note
  • Unlocks the "silver medal" achievement if the player has unlocked for every event a silver medal or obove
  • Unlocks the "gold medal" achievement if the player has unlocked for every event a gold medal
void em5::PlayerProgress::unlockMedal ( const qsf::NamedIdentifier medalIdentifier,
MedalType  medalType 
)

Unlock the specified medal.

Note
  • Does nothing if the player already unlocked a better medalType for the given medalIdentifier
  • Fires a "MedalUnlocked" message into the message system if a better medal was unlocked
bool em5::PlayerProgress::wasCampaignStarted ( uint32  campaignIndex) const

Check if a certain campaign was started at least once.

bool em5::PlayerProgress::wereAllCampaignsStarted ( ) const

Check if all campaigns were started at least once.

Member Data Documentation

const char em5::PlayerProgress::LOCAL_PLAYER[]
static

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