From c628ab03e9aae0b8e56f260ad02cfc7d51285a71 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 12 Aug 2013 08:35:13 +0200 Subject: Removed cServer::BroadcastChat() and cServer::SendMessage(). These two functions make it difficult to move to the new ticking system, and they aren't used anyway. If so required, they can be emulated by ForEachWorld / ForEachPlayer calls. --- source/Player.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'source/Player.cpp') 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) -- cgit v1.2.3