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 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 31 of file Scoreboard.h.

Member Typedef Documentation

◆ cScoreMap

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

Definition at line 104 of file Scoreboard.h.

◆ cTrackedPlayer

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

Definition at line 102 of file Scoreboard.h.

◆ Score

typedef int cObjective::Score

Definition at line 35 of file Scoreboard.h.

Member Enumeration Documentation

◆ eType

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

Definition at line 37 of file Scoreboard.h.

Constructor & Destructor Documentation

◆ cObjective()

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

◆ AddScore()

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.

◆ GetDisplayName()

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

Definition at line 73 of file Scoreboard.h.

◆ GetName()

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

Definition at line 72 of file Scoreboard.h.

◆ GetScore()

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

Returns the score of the specified player.

Definition at line 103 of file Scoreboard.cpp.

◆ GetType()

eType cObjective::GetType ( void  ) const
inline

Definition at line 70 of file Scoreboard.h.

◆ Reset()

void cObjective::Reset ( void  )

Resets the objective.

Definition at line 89 of file Scoreboard.cpp.

◆ ResetScore()

void cObjective::ResetScore ( const AString a_Name)

Resets the score of the specified player.

Definition at line 132 of file Scoreboard.cpp.

◆ SendTo()

void cObjective::SendTo ( cClientHandle a_Client)

Send this objective to the specified client.

Definition at line 182 of file Scoreboard.cpp.

◆ SetDisplayName()

void cObjective::SetDisplayName ( const AString a_Name)

Definition at line 171 of file Scoreboard.cpp.

◆ SetScore()

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.

◆ StringToType()

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

Definition at line 41 of file Scoreboard.cpp.

◆ SubScore()

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.

◆ TypeToString()

AString cObjective::TypeToString ( eType  a_Type)
static

Definition at line 16 of file Scoreboard.cpp.

Friends And Related Function Documentation

◆ cScoreboardSerializer

friend class cScoreboardSerializer
friend

Definition at line 115 of file Scoreboard.h.

Member Data Documentation

◆ m_DisplayName

AString cObjective::m_DisplayName
private

Definition at line 108 of file Scoreboard.h.

◆ m_Name

AString cObjective::m_Name
private

Definition at line 109 of file Scoreboard.h.

◆ m_Scores

cScoreMap cObjective::m_Scores
private

Definition at line 106 of file Scoreboard.h.

◆ m_Type

eType cObjective::m_Type
private

Definition at line 111 of file Scoreboard.h.

◆ m_World

cWorld* cObjective::m_World
private

Definition at line 113 of file Scoreboard.h.


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