Initial handshake and network game start. Works with multiple clients. Not yet stable, because it is not thread-safe. GUI callbacks not complete yet (server dialog not updated).
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <net/connectdata.h>
|
||||
|
||||
#define SERVER_INITIAL_STATE ServerRecvStateInit
|
||||
#define SERVER_INITIAL_STATE ServerRecvStateInit
|
||||
#define SERVER_START_GAME_STATE ServerRecvStateStartGame
|
||||
|
||||
class ServerRecvThread;
|
||||
class ServerCallback;
|
||||
@@ -35,7 +36,7 @@ public:
|
||||
virtual ~ServerRecvState();
|
||||
|
||||
// Handling of a new TCP connection.
|
||||
virtual void HandleNewConnection(ServerRecvThread &server, boost::shared_ptr<ConnectData> data) = 0;
|
||||
virtual void HandleNewConnection(ServerRecvThread &server, boost::shared_ptr<ConnectData> connData) = 0;
|
||||
|
||||
// Main processing function of the current state.
|
||||
virtual int Process(ServerRecvThread &server) = 0;
|
||||
@@ -62,4 +63,25 @@ protected:
|
||||
ServerRecvStateInit();
|
||||
};
|
||||
|
||||
// State: Start server game.
|
||||
class ServerRecvStateStartGame : public ServerRecvState
|
||||
{
|
||||
public:
|
||||
// Access the state singleton.
|
||||
static ServerRecvStateStartGame &Instance();
|
||||
|
||||
virtual ~ServerRecvStateStartGame();
|
||||
|
||||
//
|
||||
virtual void HandleNewConnection(ServerRecvThread &server, boost::shared_ptr<ConnectData> data);
|
||||
|
||||
//
|
||||
virtual int Process(ServerRecvThread &server);
|
||||
|
||||
protected:
|
||||
|
||||
// Protected constructor - this is a singleton.
|
||||
ServerRecvStateStartGame();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user