summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 285aefd25..c6b24a465 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -111,8 +111,6 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
m_LastJumpHeight = (float)(GetPosY());
m_LastGroundHeight = (float)(GetPosY());
m_Stance = GetPosY() + 1.62;
-
- // UpdateTeam();
cRoot::Get()->GetServer()->PlayerCreated(this);
}
@@ -867,10 +865,10 @@ void cPlayer::KilledBy(cEntity * a_Killer)
}
} IncrementCounter (GetName());
- cScoreboard* Scoreboard = m_World->GetScoreBoard();
+ cScoreboard & Scoreboard = m_World->GetScoreBoard();
// Update scoreboard objectives
- Scoreboard->ForEachObjectiveWith(cObjective::E_TYPE_DEATH_COUNT, IncrementCounter);
+ Scoreboard.ForEachObjectiveWith(cObjective::E_TYPE_DEATH_COUNT, IncrementCounter);
}
@@ -977,9 +975,16 @@ void cPlayer::SetTeam(cTeam * a_Team)
cTeam * cPlayer::UpdateTeam(void)
{
- cScoreboard * Scoreboard = m_World->GetScoreBoard();
+ if (m_World == NULL)
+ {
+ SetTeam(NULL);
+ }
+ else
+ {
+ cScoreboard & Scoreboard = m_World->GetScoreBoard();
- m_Team = Scoreboard->QueryPlayerTeam(GetName());
+ SetTeam(Scoreboard.QueryPlayerTeam(GetName()));
+ }
return m_Team;
}