Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | Friends | List of all members
cObjective Class Reference

#include <Scoreboard.h>

Collaboration diagram for cObjective:
Collaboration graph
[legend]

Public Types

enum  eType {
  otDummy, otDeathCount, otPlayerKillCount, otTotalKillCount,
  otHealth, otAchievement, otStat, otStatItemCraft,
  otStatItemUse, otStatItemBreak, otStatBlockMine, otStatEntityKill,
  otStatEntityKilledBy
}
 
typedef int Score
 

Public Member Functions

Score AddScore (const AString &a_Name, Score a_Delta)
 Adds a_Delta and returns the new score. More...
 
 cObjective (const AString &a_Name, const AString &a_DisplayName, eType a_Type, cWorld *a_World)
 
const AStringGetDisplayName (void) const
 
const AStringGetName (void) const
 
Score GetScore (const AString &a_Name) const
 Returns the score of the specified player. More...
 
eType GetType (void) const
 
void Reset (void)
 Resets the objective. More...
 
void ResetScore (const AString &a_Name)
 Resets the score of the specified player. More...
 
void SendTo (cClientHandle &a_Client)
 Send this objective to the specified client. More...
 
void SetDisplayName (const AString &a_Name)
 
void SetScore (const AString &a_Name, Score a_Score)
 Sets the score of the specified player. More...
 
Score SubScore (const AString &a_Name, Score a_Delta)
 Subtracts a_Delta and returns the new score. More...
 

Static Public Member Functions

static const char * GetClassStatic (void)
 
static eType StringToType (const AString &a_Name)
 
static AString TypeToString (eType a_Type)
 

Private Types

typedef std::map< AString, ScorecScoreMap
 
typedef std::pair< AString, ScorecTrackedPlayer
 

Private Attributes

AString m_DisplayName
 
AString m_Name
 
cScoreMap m_Scores
 
eType m_Type
 
cWorldm_World
 

Friends

class cScoreboardSerializer
 

Detailed Description

Definition at line 29 of file Scoreboard.h.

Member Typedef Documentation

typedef std::map<AString, Score> cObjective::cScoreMap
private

Definition at line 108 of file Scoreboard.h.

typedef std::pair<AString, Score> cObjective::cTrackedPlayer
private

Definition at line 106 of file Scoreboard.h.

typedef int cObjective::Score

Definition at line 33 of file Scoreboard.h.

Member Enumeration Documentation

Enumerator
otDummy 
otDeathCount 
otPlayerKillCount 
otTotalKillCount 
otHealth 
otAchievement 
otStat 
otStatItemCraft 
otStatItemUse 
otStatItemBreak 
otStatBlockMine 
otStatEntityKill 
otStatEntityKilledBy 

Definition at line 35 of file Scoreboard.h.

Constructor & Destructor Documentation

cObjective::cObjective ( const AString a_Name,
const AString a_DisplayName,
cObjective::eType  a_Type,
cWorld a_World 
)

Definition at line 77 of file Scoreboard.cpp.

Member Function Documentation

cObjective::Score cObjective::AddScore ( const AString a_Name,
cObjective::Score  a_Delta 
)

Adds a_Delta and returns the new score.

Definition at line 143 of file Scoreboard.cpp.

static const char* cObjective::GetClassStatic ( void  )
inlinestatic

Definition at line 98 of file Scoreboard.h.

const AString& cObjective::GetDisplayName ( void  ) const
inline

Definition at line 71 of file Scoreboard.h.

const AString& cObjective::GetName ( void  ) const
inline

Definition at line 70 of file Scoreboard.h.

cObjective::Score cObjective::GetScore ( const AString a_Name) const

Returns the score of the specified player.

Definition at line 103 of file Scoreboard.cpp.

eType cObjective::GetType ( void  ) const
inline

Definition at line 68 of file Scoreboard.h.

void cObjective::Reset ( void  )

Resets the objective.

Definition at line 89 of file Scoreboard.cpp.

void cObjective::ResetScore ( const AString a_Name)

Resets the score of the specified player.

Definition at line 132 of file Scoreboard.cpp.

void cObjective::SendTo ( cClientHandle a_Client)

Send this objective to the specified client.

Definition at line 182 of file Scoreboard.cpp.

void cObjective::SetDisplayName ( const AString a_Name)

Definition at line 171 of file Scoreboard.cpp.

void cObjective::SetScore ( const AString a_Name,
cObjective::Score  a_Score 
)

Sets the score of the specified player.

Definition at line 121 of file Scoreboard.cpp.

cObjective::eType cObjective::StringToType ( const AString a_Name)
static

Definition at line 41 of file Scoreboard.cpp.

cObjective::Score cObjective::SubScore ( const AString a_Name,
cObjective::Score  a_Delta 
)

Subtracts a_Delta and returns the new score.

Definition at line 157 of file Scoreboard.cpp.

AString cObjective::TypeToString ( eType  a_Type)
static

Definition at line 16 of file Scoreboard.cpp.

Friends And Related Function Documentation

friend class cScoreboardSerializer
friend

Definition at line 119 of file Scoreboard.h.

Member Data Documentation

AString cObjective::m_DisplayName
private

Definition at line 112 of file Scoreboard.h.

AString cObjective::m_Name
private

Definition at line 113 of file Scoreboard.h.

cScoreMap cObjective::m_Scores
private

Definition at line 110 of file Scoreboard.h.

eType cObjective::m_Type
private

Definition at line 115 of file Scoreboard.h.

cWorld* cObjective::m_World
private

Definition at line 117 of file Scoreboard.h.


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