summaryrefslogtreecommitdiffstats
path: root/source/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-12 08:35:13 +0200
committermadmaxoft <github@xoft.cz>2013-08-12 08:35:13 +0200
commitc628ab03e9aae0b8e56f260ad02cfc7d51285a71 (patch)
tree402ee387cbf33bd6ca39f718f7addb4fdcc82dd2 /source/Player.cpp
parentRemoved unused cServer::IsConnected() function. (diff)
downloadcuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.tar
cuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.tar.gz
cuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.tar.bz2
cuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.tar.lz
cuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.tar.xz
cuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.tar.zst
cuberite-c628ab03e9aae0b8e56f260ad02cfc7d51285a71.zip
Diffstat (limited to 'source/Player.cpp')
-rw-r--r--source/Player.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index 03c871736..df7e1d539 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -129,6 +129,12 @@ bool cPlayer::Initialize(cWorld * a_World)
{
if (super::Initialize(a_World))
{
+ // Remove the client handle from the server, it will be ticked from this object from now on
+ if (m_ClientHandle != NULL)
+ {
+ cRoot::Get()->GetServer()->ClientMovedToWorld(m_ClientHandle);
+ }
+
GetWorld()->AddPlayer(this);
return true;
}
@@ -175,18 +181,22 @@ void cPlayer::SpawnOn(cClientHandle & a_Client)
void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
{
- if (!m_ClientHandle->IsPlaying())
+ if (m_ClientHandle != NULL)
{
- // We're not yet in the game, ignore everything
- return;
+ if (!m_ClientHandle->IsPlaying())
+ {
+ // We're not yet in the game, ignore everything
+ return;
+ }
+ m_ClientHandle->Tick(a_Dt);
}
super::Tick(a_Dt, a_Chunk);
- // set player swimming state
- SetSwimState( a_Chunk);
+ // Set player swimming state
+ SetSwimState(a_Chunk);
- // handle air drowning stuff
+ // Handle air drowning stuff
HandleAir();
if (m_bDirtyPosition)