Chat messages are now working.

This commit is contained in:
lotodore
2007-05-25 16:03:12 +00:00
parent d01ecaf885
commit 13a731e041
21 changed files with 761 additions and 337 deletions
+29 -15
View File
@@ -32,6 +32,7 @@ class ClientThread;
class ClientCallback;
class ResolverThread;
class Game;
class NetPacket;
class ClientState
{
@@ -166,8 +167,24 @@ protected:
ClientStateStartSession();
};
// Abstract State: Receiving
class AbstractClientStateReceiving : public ClientState
{
public:
virtual ~AbstractClientStateReceiving();
// select on socket.
virtual int Process(ClientThread &client);
protected:
virtual int InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet) = 0;
AbstractClientStateReceiving();
};
// State: Wait for Session ACK.
class ClientStateWaitSession : public ClientState
class ClientStateWaitSession : public AbstractClientStateReceiving
{
public:
// Access the state singleton.
@@ -175,17 +192,17 @@ public:
virtual ~ClientStateWaitSession();
// select on socket.
virtual int Process(ClientThread &client);
protected:
// Protected constructor - this is a singleton.
ClientStateWaitSession();
virtual int InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet);
};
// State: Wait for start of the game or start info.
class ClientStateWaitGame : public ClientState
class ClientStateWaitGame : public AbstractClientStateReceiving
{
public:
// Access the state singleton.
@@ -193,17 +210,16 @@ public:
virtual ~ClientStateWaitGame();
// select on socket.
virtual int Process(ClientThread &client);
protected:
// Protected constructor - this is a singleton.
ClientStateWaitGame();
virtual int InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet);
};
// State: Wait for start of the next hand.
class ClientStateWaitHand : public ClientState
class ClientStateWaitHand : public AbstractClientStateReceiving
{
public:
// Access the state singleton.
@@ -211,17 +227,16 @@ public:
virtual ~ClientStateWaitHand();
// select on socket.
virtual int Process(ClientThread &client);
protected:
// Protected constructor - this is a singleton.
ClientStateWaitHand();
virtual int InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet);
};
// State: Hand Loop.
class ClientStateRunHand : public ClientState
class ClientStateRunHand : public AbstractClientStateReceiving
{
public:
// Access the state singleton.
@@ -229,14 +244,13 @@ public:
virtual ~ClientStateRunHand();
// select on socket.
virtual int Process(ClientThread &client);
protected:
// Protected constructor - this is a singleton.
ClientStateRunHand();
virtual int InternalProcess(ClientThread &client, boost::shared_ptr<NetPacket> packet);
static int GetHighestSet(Game &curGame);
static void SetHighestSet(Game &curGame, int highestSet);
static int GetPlayersTurn(Game &curGame);