Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9284 in orxonox.OLD


Ignore:
Timestamp:
Jul 14, 2006, 10:32:02 AM (18 years ago)
Author:
patrick
Message:

peerinfos are now gettable from outside

Location:
branches/proxy/src/lib/network
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/monitor/network_monitor.cc

    r9283 r9284  
    4040  this->networkStream = networkStream;
    4141  this->playerNumber = 0;
    42   this->localNode = new NetworkNode();
     42  this->localNode = new NetworkNode( this->networkStream->getPeerInfo());
    4343
    4444  this->setSynchronized(false);
  • branches/proxy/src/lib/network/monitor/network_node.cc

    r9277 r9284  
    1616#include "network_node.h"
    1717
    18 
    1918#include "debug.h"
    2019
     
    2322 * constructor
    2423 */
    25 NetworkNode::NetworkNode()
     24NetworkNode::NetworkNode(PeerInfo* pInfo)
    2625{
    2726  this->playerNumber = 0;
    28   this->nodeType = NET_CLIENT;
     27  this->peerInfo = pInfo;
    2928}
    3029
  • branches/proxy/src/lib/network/monitor/network_node.h

    r9279 r9284  
    99#include "base_object.h"
    1010#include "synchronizeable.h"
     11#include "peer_info.h"
    1112
    1213#include <list>
    1314
    14 class PeerInfo;
    1515
    1616//!< a class representing a node in the network (this can be a MASTER_SERVER, PROXY_SERVER or a CLIENT
     
    1818{
    1919  public:
    20     NetworkNode();
     20    NetworkNode(PeerInfo* pInfo);
    2121    ~NetworkNode();
    2222
     
    3333    inline int getPlayerNumber() { return this->playerNumber; }
    3434    /** @returns the node type of this node */
    35     inline int getNodeType() { return this->nodeType; }
     35    inline int getNodeType() { return this->peerInfo->nodeType; }
    3636
    3737
    3838  private:
    39     int                          nodeType;                     //!< the type of the node
    4039    int                          playerNumber;                 //!< localy direct connected player number
     40    PeerInfo*                    peerInfo;                     //!< the peer informationa about this node
    4141
    4242    /* network nodes directly connected to this node */
  • branches/proxy/src/lib/network/network_stream.cc

    r9282 r9284  
    107107  this->networkMonitor = NULL;
    108108
     109  this->pInfo = new PeerInfo();
     110  this->pInfo->nodeType = NET_CLIENT;
     111  this->pInfo->userId = 0;
     112  this->pInfo->lastAckedState = 0;
     113  this->pInfo->lastRecvedState = 0;
     114
    109115  this->myHostId = 0;
    110116  this->currentState = 0;
     
    154160  for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ )
    155161    (*it)->setNetworkStream( NULL );
     162
     163  if( this->pInfo)
     164    delete this->pInfo;
    156165}
    157166
  • branches/proxy/src/lib/network/network_stream.h

    r9282 r9284  
    6060    inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient(); }
    6161
     62    /* peering interface */
     63    inline PeerInfo & getPeerInfo( int userId ) { return peers[userId]; }
     64    inline PeerInfo* getPeerInfo() { return this->pInfo; }
     65    inline PeerList getPeerInfoList() { return this->peers; }
    6266
     67    /* data processing*/
    6368    virtual void processData();
    6469
     70    /* debugging */
    6571    void debug();
    6672
     
    7076    inline SynchronizeableList::const_iterator getSyncBegin(){ return synchronizeables.begin(); }
    7177    inline SynchronizeableList::const_iterator getSyncEnd(){ return synchronizeables.end(); }
    72     inline PeerInfo & getPeerInfo( int userId ) { return peers[userId]; }
    7378    void cleanUpOldSyncList();
    7479    int getSyncCount();
     
    8893    PeerList                   peers;                       //!< list of the network node informations
    8994
     95    PeerInfo*                  pInfo;                       //!< the info about the local peer node (not in the PeerList)
    9096    int                        nodeType;                    //!< the type of this host (NET_CLIENT, NET_MASTER_SERVER,...)
    9197    int                        myHostId;                    //!< the host id of the localhost
Note: See TracChangeset for help on using the changeset viewer.