From e34f097543c7a2b733a6d6a8b55a26a6777b5e83 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 11 Nov 2012 14:00:58 +0000 Subject: Hopefully a fix for crash when chunks are added to a client being destroyed. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1032 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ClientHandle.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source/ClientHandle.h') diff --git a/source/ClientHandle.h b/source/ClientHandle.h index a9a372186..ec79b3b71 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -69,14 +69,15 @@ public: // Removes the client from all chunks. Used when switching worlds or destroying the player void RemoveFromAllChunks(void); - inline bool IsLoggedIn(void) const { return m_State >= csAuthenticating; } + inline bool IsLoggedIn(void) const { return (m_State >= csAuthenticating); } void Tick(float a_Dt); - bool IsDestroyed() { return m_bDestroyed; } - void Destroy(); + void Destroy(void); - bool IsPlaying(void) const {return (m_State == csPlaying); } + bool IsPlaying (void) const { return (m_State == csPlaying); } + bool IsDestroyed (void) const { return (m_State == csDestroyed); } + bool IsDestroying(void) const { return (m_State == csDestroying); } void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType); void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); @@ -124,10 +125,10 @@ public: const AString & GetUsername(void) const; //tolua_export void SetUsername( const AString & a_Username ); //tolua_export - inline short GetPing() const { return m_Ping; } //tolua_export + inline short GetPing(void) const { return m_Ping; } //tolua_export - void SetViewDistance(int a_ViewDistance); //tolua_export - int GetViewDistance() { return m_ViewDistance; }//tolua_export + void SetViewDistance(int a_ViewDistance); // tolua_export + int GetViewDistance(void) const { return m_ViewDistance; } // tolua_export int GetUniqueID() const { return m_UniqueID; } //tolua_export @@ -199,7 +200,6 @@ private: Vector3d m_ConfirmPosition; - bool m_bDestroyed; cPlayer * m_Player; bool m_bKicking; @@ -230,8 +230,10 @@ private: csDownloadingWorld, // The client is waiting for chunks, we're waiting for the loader to provide and send them csConfirmingPos, // The client has been sent the position packet, waiting for them to repeat the position back csPlaying, // Normal gameplay + csDestroying, // The client is being destroyed, don't queue any more packets / don't add to chunks + csDestroyed, // The client has been destroyed, the destructor is to be called from the owner thread - // TODO: Add Kicking and Destroyed here as well + // TODO: Add Kicking here as well } ; eState m_State; -- cgit v1.2.3