1
0

Exported and documented cScoreboard

This commit is contained in:
andrew
2014-03-01 12:06:19 +02:00
parent c18748648d
commit 5c44945287
5 changed files with 166 additions and 55 deletions

View File

@@ -246,6 +246,17 @@ void cTeam::Reset(void)
void cTeam::SetDisplayName(const AString & a_Name)
{
m_DisplayName = a_Name;
// TODO 2014-03-01 xdot: Update clients
}
unsigned int cTeam::GetNumPlayers(void) const
{
return m_Players.size();
@@ -306,6 +317,8 @@ bool cScoreboard::RemoveObjective(const AString & a_Name)
ASSERT(m_World != NULL);
m_World->BroadcastScoreboardObjective(it->second.GetName(), it->second.GetDisplayName(), 1);
// TODO 2014-03-01 xdot: Remove objective from display slot
return true;
}
@@ -465,6 +478,23 @@ void cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallb
void cScoreboard::AddPlayerScore(const AString & a_Name, cObjective::eType a_Type, cObjective::Score a_Value)
{
cCSLock Lock(m_CSObjectives);
for (cObjectiveMap::iterator it = m_Objectives.begin(); it != m_Objectives.end(); ++it)
{
if (it->second.GetType() == a_Type)
{
it->second.AddScore(a_Name, a_Value);
}
}
}
void cScoreboard::SendTo(cClientHandle & a_Client)
{
cCSLock Lock(m_CSObjectives);