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

#include <Scoreboard.h>

Collaboration diagram for cScoreboard:
Collaboration graph
[legend]

Public Types

enum  eDisplaySlot { dsList = 0, dsSidebar, dsName, dsCount }
 

Public Member Functions

void AddPlayerScore (const AString &a_Name, cObjective::eType a_Type, cObjective::Score a_Value=1)
 
 cScoreboard (cWorld *a_World)
 
bool ForEachObjective (cObjectiveCallback a_Callback)
 Execute callback for each objective. More...
 
bool ForEachObjectiveWith (cObjective::eType a_Type, cObjectiveCallback a_Callback)
 Execute callback for each objective with the specified type Returns true if all objectives processed, false if the callback aborted by returning true. More...
 
bool ForEachTeam (cTeamCallback a_Callback)
 Execute callback for each team. More...
 
size_t GetNumObjectives (void) const
 
size_t GetNumTeams (void) const
 
cObjectiveGetObjective (const AString &a_Name)
 Retrieves the objective with the specified name, nullptr if not found. More...
 
cObjectiveGetObjectiveIn (eDisplaySlot a_Slot)
 
cTeamGetTeam (const AString &a_Name)
 Retrieves the team with the specified name, nullptr if not found. More...
 
AStringVector GetTeamNames ()
 Retrieves the list of team names. More...
 
cTeamQueryPlayerTeam (const AString &a_Name)
 
cObjectiveRegisterObjective (const AString &a_Name, const AString &a_DisplayName, cObjective::eType a_Type)
 Registers a new scoreboard objective, returns the cObjective instance, nullptr on name collision. More...
 
cTeamRegisterTeam (const AString &a_Name, const AString &a_DisplayName, const AString &a_Prefix, const AString &a_Suffix)
 Registers a new team, returns the cTeam instance, nullptr on name collision. More...
 
bool RemoveObjective (const AString &a_Name)
 Removes a registered objective, returns true if operation was successful. More...
 
bool RemoveTeam (const AString &a_Name)
 Removes a registered team, returns true if operation was successful. More...
 
void SendTo (cClientHandle &a_Client)
 Send this scoreboard to the specified client. More...
 
void SetDisplay (const AString &a_Objective, eDisplaySlot a_Slot)
 
void SetDisplay (cObjective *a_Objective, eDisplaySlot a_Slot)
 

Private Types

typedef std::pair< AString, cObjectivecNamedObjective
 
typedef std::pair< AString, cTeamcNamedTeam
 
typedef std::map< AString, cObjectivecObjectiveMap
 
typedef std::map< AString, cTeamcTeamMap
 

Private Attributes

cCriticalSection m_CSObjectives
 
cCriticalSection m_CSTeams
 
cObjectivem_Display [dsCount]
 
cObjectiveMap m_Objectives
 
cTeamMap m_Teams
 
cWorldm_World
 

Friends

class cScoreboardSerializer
 

Detailed Description

Definition at line 208 of file Scoreboard.h.

Member Typedef Documentation

typedef std::pair<AString, cObjective> cScoreboard::cNamedObjective
private

Definition at line 285 of file Scoreboard.h.

typedef std::pair<AString, cTeam> cScoreboard::cNamedTeam
private

Definition at line 286 of file Scoreboard.h.

typedef std::map<AString, cObjective> cScoreboard::cObjectiveMap
private

Definition at line 288 of file Scoreboard.h.

typedef std::map<AString, cTeam> cScoreboard::cTeamMap
private

Definition at line 289 of file Scoreboard.h.

Member Enumeration Documentation

Enumerator
dsList 
dsSidebar 
dsName 
dsCount 

Definition at line 212 of file Scoreboard.h.

Constructor & Destructor Documentation

cScoreboard::cScoreboard ( cWorld a_World)

Definition at line 273 of file Scoreboard.cpp.

Member Function Documentation

void cScoreboard::AddPlayerScore ( const AString a_Name,
cObjective::eType  a_Type,
cObjective::Score  a_Value = 1 
)

Definition at line 546 of file Scoreboard.cpp.

bool cScoreboard::ForEachObjective ( cObjectiveCallback  a_Callback)

Execute callback for each objective.

Returns true if all objectives have been processed, false if the callback aborted by returning true.

Definition at line 508 of file Scoreboard.cpp.

bool cScoreboard::ForEachObjectiveWith ( cObjective::eType  a_Type,
cObjectiveCallback  a_Callback 
)

Execute callback for each objective with the specified type Returns true if all objectives processed, false if the callback aborted by returning true.

Definition at line 486 of file Scoreboard.cpp.

bool cScoreboard::ForEachTeam ( cTeamCallback  a_Callback)

Execute callback for each team.

Returns true if all teams have been processed, false if the callback aborted by returning true.

Definition at line 527 of file Scoreboard.cpp.

size_t cScoreboard::GetNumObjectives ( void  ) const

Definition at line 588 of file Scoreboard.cpp.

size_t cScoreboard::GetNumTeams ( void  ) const

Definition at line 597 of file Scoreboard.cpp.

cObjective * cScoreboard::GetObjective ( const AString a_Name)

Retrieves the objective with the specified name, nullptr if not found.

Definition at line 339 of file Scoreboard.cpp.

cObjective * cScoreboard::GetObjectiveIn ( eDisplaySlot  a_Slot)

Definition at line 475 of file Scoreboard.cpp.

cTeam * cScoreboard::GetTeam ( const AString a_Name)

Retrieves the team with the specified name, nullptr if not found.

Definition at line 395 of file Scoreboard.cpp.

AStringVector cScoreboard::GetTeamNames ( )

Retrieves the list of team names.

Definition at line 415 of file Scoreboard.cpp.

cTeam * cScoreboard::QueryPlayerTeam ( const AString a_Name)

Definition at line 431 of file Scoreboard.cpp.

cObjective * cScoreboard::RegisterObjective ( const AString a_Name,
const AString a_DisplayName,
cObjective::eType  a_Type 
)

Registers a new scoreboard objective, returns the cObjective instance, nullptr on name collision.

Definition at line 285 of file Scoreboard.cpp.

cTeam * cScoreboard::RegisterTeam ( const AString a_Name,
const AString a_DisplayName,
const AString a_Prefix,
const AString a_Suffix 
)

Registers a new team, returns the cTeam instance, nullptr on name collision.

Definition at line 359 of file Scoreboard.cpp.

bool cScoreboard::RemoveObjective ( const AString a_Name)

Removes a registered objective, returns true if operation was successful.

Definition at line 308 of file Scoreboard.cpp.

bool cScoreboard::RemoveTeam ( const AString a_Name)

Removes a registered team, returns true if operation was successful.

Definition at line 375 of file Scoreboard.cpp.

void cScoreboard::SendTo ( cClientHandle a_Client)

Send this scoreboard to the specified client.

Definition at line 563 of file Scoreboard.cpp.

void cScoreboard::SetDisplay ( const AString a_Objective,
eDisplaySlot  a_Slot 
)

Definition at line 450 of file Scoreboard.cpp.

void cScoreboard::SetDisplay ( cObjective a_Objective,
eDisplaySlot  a_Slot 
)

Definition at line 463 of file Scoreboard.cpp.

Friends And Related Function Documentation

friend class cScoreboardSerializer
friend

Definition at line 302 of file Scoreboard.h.

Member Data Documentation

cCriticalSection cScoreboard::m_CSObjectives
private

Definition at line 292 of file Scoreboard.h.

cCriticalSection cScoreboard::m_CSTeams
private

Definition at line 295 of file Scoreboard.h.

cObjective* cScoreboard::m_Display[dsCount]
private

Definition at line 300 of file Scoreboard.h.

cObjectiveMap cScoreboard::m_Objectives
private

Definition at line 293 of file Scoreboard.h.

cTeamMap cScoreboard::m_Teams
private

Definition at line 296 of file Scoreboard.h.

cWorld* cScoreboard::m_World
private

Definition at line 298 of file Scoreboard.h.


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