diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 20:41:19 +0200 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 20:41:19 +0200 |
commit | 386d58b5862d8b76925c6523721594887606e82a (patch) | |
tree | ef073e7a843f4b75a4008d4b7383f7cdf08ceee5 /source/cClientHandle.h | |
parent | Visual Studio 2010 solution and project files (diff) | |
download | cuberite-386d58b5862d8b76925c6523721594887606e82a.tar cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.gz cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.bz2 cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.lz cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.xz cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.zst cuberite-386d58b5862d8b76925c6523721594887606e82a.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cClientHandle.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/source/cClientHandle.h b/source/cClientHandle.h new file mode 100644 index 000000000..224ba46b3 --- /dev/null +++ b/source/cClientHandle.h @@ -0,0 +1,70 @@ +#pragma once
+
+class cSocket;
+class cSemaphore;
+class cEvent;
+class Game;
+class cPacket;
+class cChunk;
+class cPlayer;
+class cClientHandle // tolua_export
+{ // tolua_export
+public:
+ enum ENUM_PRIORITY
+ {
+ E_PRIORITY_LOW,
+ E_PRIORITY_NORMAL
+ };
+
+ cClientHandle(const cSocket & a_Socket);
+ ~cClientHandle();
+
+ static const int VIEWDISTANCE = 13;
+
+ const cSocket & GetSocket();
+ cPlayer* GetPlayer() { return m_Player; } // tolua_export
+
+ void Kick( const char* a_Reason ); //tolua_export
+
+ void AddPacket( cPacket * a_Packet );
+ void HandlePendingPackets();
+
+ void StreamChunks();
+ void StreamChunksSmart( cChunk** a_Chunks, unsigned int a_NumChunks );
+
+ inline void SetLoggedIn( bool a_bLoggedIn ) { m_bLoggedIn = a_bLoggedIn; }
+ inline bool IsLoggedIn() { return m_bLoggedIn; }
+
+ void Tick(float a_Dt);
+
+ bool IsDestroyed() { return m_bDestroyed; }
+ void Destroy();
+
+ cChunk* m_LoadedChunks[VIEWDISTANCE*VIEWDISTANCE];
+
+ void Send( const cPacket & a_Packet, ENUM_PRIORITY a_Priority = E_PRIORITY_NORMAL );
+
+ static void SendThread( void *lpParam );
+ static void ReceiveThread( void *lpParam );
+ static void AuthenticateThread( void* a_Param );
+
+ const char* GetUsername();
+private:
+ void HandlePacket( cPacket* a_Packet );
+ void RemovePacket( cPacket * a_Packet );
+
+ void SendLoginResponse();
+
+ struct sClientHandleState;
+ sClientHandleState* m_pState;
+
+ bool m_bDestroyed;
+ cPlayer* m_Player;
+ bool m_bKicking;
+
+ float m_TimeLastPacket;
+
+ bool m_bLoggedIn;
+
+ bool m_bKeepThreadGoing;
+}; // tolua_export
|