summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-01-21 14:58:17 +0100
committerandrew <xdotftw@gmail.com>2014-01-21 14:58:17 +0100
commitaa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014 (patch)
tree42e227cd81bced9bc42b4f686753ccbde1b95caa /src/Entities
parentScoreboard serialization (diff)
downloadcuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar
cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.gz
cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.bz2
cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.lz
cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.xz
cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.tar.zst
cuberite-aa61f55b743a8ecf3cd8e1f99e1d9a0308f6d014.zip
Diffstat (limited to 'src/Entities')
-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;
}