home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 March / ENTER.ISO / files / fwp-0.0.6-win32-installer.exe / Client.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-12-19  |  1.9 KB  |  76 lines

  1. #ifndef __Client_h__
  2. #define __Client_h__
  3.  
  4. //#include "SDL/SDL_net.h"
  5. #include "PacketHandler.h"
  6.  
  7. #define CLIENT_MAX_NAME_LENGTH 32
  8.  
  9. class Vehicle;
  10. class Shot;
  11.  
  12. class Client{
  13. public:
  14.     IPaddress ipAddress;
  15.     UDPsocket socket;
  16. //    char name[CLIENT_MAX_NAME_LENGTH];
  17.     int clientId;
  18. //    int ping;
  19.     unsigned long lastPingMillis;
  20.     unsigned long momentOfConnectMillis; // only for server!
  21. //    int secondsOnServer;
  22.     unsigned long lastClientstateMillis;
  23.     unsigned long nextSpawnMillis;    
  24.     unsigned long lastSpawnMillis;
  25. //    bool isReady;
  26.  
  27.     clientinfoPacket_t ci;
  28.     clientstatePacket_t cs;
  29.  
  30.     Vehicle* vehicle;
  31.  
  32.     Client();
  33.     ~Client();
  34.  
  35. //    void fillInPlayerInfo(playerinfoPacket_t* pi, int index);
  36.     void setName(char* newName);
  37.     int getClientId();
  38. //    bool makeLoopbackConnection();
  39.     bool openPort();
  40.     bool closePort();
  41.  
  42.     bool connect();
  43.     bool disconnect();
  44. //    bool getServerinfo();
  45. //    bool getPlayerinfo();
  46.  
  47.     void sendChatMessage(unsigned char mode, const char* message);
  48.     void sendVoiceMessage(unsigned char mode, char messageId);
  49.     void sendClientstate();
  50.     void sendClientSpawn();
  51.     void sendClientKill();
  52.     void sendShotSpawn(Shot* shot);
  53.  
  54.     void sendPackets();
  55.     void receivePackets();
  56.     void handlePacket(UDPpacket* packet);
  57.     void emptyPacketQueue();
  58.  
  59.     void handlePing(UDPpacket* packet);
  60.     void handleDisconnect(UDPpacket* packet);
  61.     void handleClientConnected(UDPpacket* packet);
  62.     void handleClientDisconnected(UDPpacket* packet);
  63.  
  64.     void handleChatMessage(UDPpacket* packet);
  65.     void handleVoiceMessage(UDPpacket* packet);
  66.     void handlePlayerinfo(UDPpacket* packet);
  67.     void handleGamestate(UDPpacket* packet);
  68.     void handleClientSpawn(UDPpacket* packet);
  69.     void handleClientHurt(UDPpacket* packet);
  70.     void handleClientKill(UDPpacket* packet);
  71.     void handleShotSpawn(UDPpacket* packet);
  72.     void handleArenaChange(UDPpacket* packet);
  73. };
  74.  
  75. #endif    /* __Client_h__ */
  76.