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:
lotodore
2007-03-20 02:20:50 +00:00
parent 5f7ff8ca54
commit ef10602d5c
33 changed files with 731 additions and 113 deletions
+24 -2
View File
@@ -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