Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 7, 2008, 5:03:10 PM (16 years ago)
Author:
scheusso
Message:

network branch merged into trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/Client.h

    r1535 r1735  
    4646#include <string>
    4747
     48#include "Host.h"
     49#include "packet/Chat.h"
    4850#include "ClientConnection.h"
    49 #include "PacketManager.h"
    50 #include "GameStateClient.h"
     51#include "GamestateClient.h"
    5152//#include "NetworkFrameListener.h"
    5253
     
    6263  *
    6364  */
    64   class _NetworkExport Client : PacketDecoder{
     65  class _NetworkExport Client : public Host{
    6566  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:
    8467    Client();
    8568    Client(std::string address, int port);
     
    8770    ~Client();
    8871   
    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:
    9088   
    9189    ClientConnection client_connection;
    92     PacketGenerator pck_gen;
    93     GameStateClient gamestate;
     90    GamestateClient gamestate;
    9491    bool isConnected;
    9592    bool isSynched_;
     
    9895   
    9996    // 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 );
    10498    int clientID_;     // this is the id the server gave to us
    10599    int shipID_;
Note: See TracChangeset for help on using the changeset viewer.