summaryrefslogtreecommitdiffstats
path: root/source/cServer.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 20:41:19 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 20:41:19 +0200
commit386d58b5862d8b76925c6523721594887606e82a (patch)
treeef073e7a843f4b75a4008d4b7383f7cdf08ceee5 /source/cServer.h
parentVisual Studio 2010 solution and project files (diff)
downloadcuberite-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/cServer.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/source/cServer.h b/source/cServer.h
new file mode 100644
index 000000000..c8a669949
--- /dev/null
+++ b/source/cServer.h
@@ -0,0 +1,53 @@
+#pragma once
+
+class cEvent;
+class cSemaphore;
+class cCriticalSection;
+class cPlayer;
+class cClientHandle;
+class cPacket;
+class cServer //tolua_export
+{ //tolua_export
+public: //tolua_export
+ static cServer * GetServer(); //tolua_export
+
+ bool InitServer( int a_Port = 25565 );
+
+ int GetPort() { return m_iServerPort; }
+ bool IsConnected(){return m_bIsConnected;} // returns connection status
+ void StartListenClient(); // Listen to client
+ int RecClient(cClientHandle *sRecSocket); // receive message for a particular socket
+
+ void Broadcast( const cPacket & a_Packet, cClientHandle* a_Exclude = 0 );
+ void SendAllEntitiesTo( cClientHandle* a_Target );
+
+ bool Tick(float a_Dt);
+
+ void StartListenThread();
+
+ bool Command( cClientHandle & a_Client, const char* a_Cmd );
+ void ServerCommand( const char* a_Cmd ); //tolua_export
+ void Shutdown();
+
+ void SendMessage( const char* a_Message, cPlayer* a_Player = 0, bool a_bExclude = false ); //tolua_export
+
+ static void ServerListenThread( void* a_Args );
+
+ const char* GetServerID();
+private:
+ friend class cRoot; // so cRoot can create and destroy cServer
+ cServer();
+ ~cServer();
+
+ struct sServerState;
+ sServerState* m_pState;
+
+ // Time since server was started
+ float m_Millisecondsf;
+ unsigned int m_Milliseconds;
+
+ bool m_bIsConnected; // true - connected false - not connected
+ int m_iServerPort;
+
+ bool m_bRestarting;
+}; //tolua_export