Changeset 1735 for code/trunk/src/network/Client.h
- Timestamp:
- Sep 7, 2008, 5:03:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/Client.h
r1535 r1735 46 46 #include <string> 47 47 48 #include "Host.h" 49 #include "packet/Chat.h" 48 50 #include "ClientConnection.h" 49 #include "PacketManager.h" 50 #include "GameStateClient.h" 51 #include "GamestateClient.h" 51 52 //#include "NetworkFrameListener.h" 52 53 … … 62 63 * 63 64 */ 64 class _NetworkExport Client : PacketDecoder{65 class _NetworkExport Client : public Host{ 65 66 public: 66 67 static Client* createSingleton();68 static Client* createSingleton(std::string address, int port);69 static Client* createSingleton(const char *address, int port);70 static void destroySingleton();71 static Client *getSingleton();72 73 bool establishConnection();74 bool closeConnection();75 76 static void Chat( std::string message );77 78 int getShipID(){return shipID_;}79 int getClientID(){return clientID_;}80 81 void tick(float time);82 83 private:84 67 Client(); 85 68 Client(std::string address, int port); … … 87 70 ~Client(); 88 71 89 static Client* _sClient; 72 bool establishConnection(); 73 bool closeConnection(); 74 bool queuePacket(ENetPacket *packet, int clientID); 75 bool processChat(packet::Chat *message, unsigned int clientID); 76 //bool sendChat(packet::Chat *chat); 77 78 // static void Chat( std::string message ); 79 80 unsigned int shipID(){return shipID_;} 81 int playerID(){return clientID_;} 82 //static void setShipID( unsigned int shipID){ dynamic_cast<Client *>(instance_)->shipID_=shipID; } 83 static void setClientID( unsigned int clientID){ dynamic_cast<Client *>(instance_)->clientID_=clientID; } 84 85 void tick(float time); 86 87 private: 90 88 91 89 ClientConnection client_connection; 92 PacketGenerator pck_gen; 93 GameStateClient gamestate; 90 GamestateClient gamestate; 94 91 bool isConnected; 95 92 bool isSynched_; … … 98 95 99 96 // implement data processing functions of PacketDecoder 100 void processGamestate( GameStateCompressed *data, int clientID); 101 void processClassid(classid *clid); 102 void processChat( chat *data, int clientId ); 103 bool processWelcome( welcome *w ); 97 // void processChat( chat *data, int clientId ); 104 98 int clientID_; // this is the id the server gave to us 105 99 int shipID_;
Note: See TracChangeset
for help on using the changeset viewer.