diff options
author | madmaxoft <github@xoft.cz> | 2013-08-12 08:35:13 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-12 08:35:13 +0200 |
commit | c628ab03e9aae0b8e56f260ad02cfc7d51285a71 (patch) | |
tree | 402ee387cbf33bd6ca39f718f7addb4fdcc82dd2 /source/Player.cpp | |
parent | Removed unused cServer::IsConnected() function. (diff) | |
download | cuberite-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.cpp | 22 |
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) |