Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 7:04:09 PM (16 years ago)
Author:
landauf
Message:

merged objecthierarchy branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/network/ClientInformation.h

    r1735 r2087  
    4646#include <boost/thread/recursive_mutex.hpp>
    4747
    48 #define GAMESTATEID_INITIAL -1
    49 #define CLIENTID_UNKNOWN -2
    50 
    5148// WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE
    5249
    5350namespace network
    5451{
     52  static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
     53  static const unsigned int CLIENTID_UNKNOWN = (unsigned int)-2;
     54
    5555  /**
    5656  * This class implements a list for client informations
    5757  * @author Oliver Scheuss
    5858  */
    59   class ClientInformation{
     59  class _NetworkExport ClientInformation{
    6060  public:
    6161    ClientInformation();
     
    6666    ClientInformation *prev();
    6767    static ClientInformation *insertBack(ClientInformation *ins);
    68    
     68
    6969    // set functions
    7070    void setID(int clientID);
     
    7373    bool setPartialGamestateID(int id);
    7474    inline void setShipID(unsigned int id){ShipID_=id;}
    75    
     75
    7676    // get functions
    7777    inline unsigned int getShipID(){return ShipID_;}
    78     int getID();
    79     int getGamestateID();
    80     int getPartialGamestateID();
     78    unsigned int getID();
     79    unsigned int getGamestateID();
     80    unsigned int getPartialGamestateID();
    8181    ENetPeer *getPeer();
    82    
     82
    8383    int getFailures();
    8484    void addFailure();
    8585    void resetFailures();
    8686    enet_uint32 getRTT();
    87     enet_uint32 getPacketLoss();
    88    
    89     static bool removeClient(int clientID);
     87    double getPacketLoss();
     88
     89    static bool removeClient(unsigned int clientID);
    9090    static bool removeClient(ENetPeer *peer);
    91     static ClientInformation *findClient(int clientID, bool look_backwards=false);
     91    static ClientInformation *findClient(unsigned int clientID, bool look_backwards=false);
    9292    static ClientInformation *findClient(ENetAddress *address, bool look_backwards=false);
    9393    static ClientInformation *getBegin(){return head_;}
     
    9999  private:
    100100    static ClientInformation *head_;
    101    
     101
    102102    bool setNext(ClientInformation *next);
    103103    bool setPrev(ClientInformation *prev);
    104104    ClientInformation *insertAfter(ClientInformation *ins);
    105105    ClientInformation *insertBefore(ClientInformation *ins);
    106    
     106
    107107    ClientInformation *preve;
    108108    ClientInformation *nexte;
    109109    //actual information:
    110110    ENetPeer *peer_;
    111     int clientID_;
    112     int gamestateID_;
    113     int partialGamestateID_;
     111    unsigned int clientID_;
     112    unsigned int gamestateID_;
     113    unsigned int partialGamestateID_;
    114114    unsigned int ShipID_;   // this is the unique objectID
    115115    bool synched_;
    116116    unsigned short failures_;
    117    
     117
    118118  };
    119119
Note: See TracChangeset for help on using the changeset viewer.