Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9277 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 13, 2006, 10:50:10 PM (18 years ago)
Author:
patrick
Message:

better interface now

Location:
branches/proxy/src/lib/network/monitor
Files:
4 edited

Legend:

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

    r9276 r9277  
    4646
    4747/**
    48  * adds a client
     48 * add the network node
     49 * @param node to add
    4950 */
    50 void NetworkMonitor::addClient(PeerInfo* node)
     51void NetworkMonitor::addNetworkNode(NetworkNode* node)
    5152{
    52   this->clientList.push_back(node);
    53   this->playerNumber++;
     53  this->nodeList.push_back(node);
    5454}
    5555
    56 /**
    57  * adds a proxy server
    58  */
    59 void NetworkMonitor::addProxyServer(PeerInfo* node)
    60 {
    61   this->proxyServerList.push_back(node);
    62   this->playerNumber++;
    63 }
    6456
    6557/**
    66  * adds a master server
     58 * add the network node
     59 * @param node to add
    6760 */
    68 void NetworkMonitor::addMasterServer(PeerInfo* node)
     61void NetworkMonitor::removeNetworkNode(NetworkNode* node)
    6962{
    70   this->masterServerList.push_back(node);
    71   this->playerNumber++;
    72 }
    73 
    74 /**
    75  * removes a client
    76  */
    77 void NetworkMonitor::removeClient(PeerInfo* node)
    78 {
    79   std::list<PeerInfo*>::iterator it = this->clientList.begin();
    80   for(; it != this->clientList.end(); it++)
     63  std::list<NetworkNode*>::iterator it = this->nodeList.begin();
     64  for(; it != this->nodeList.end(); it++)
    8165  {
    8266    if( *it == node)
    8367    {
    84       this->clientList.erase(it);
     68      this->nodeList.erase(it);
    8569      this->playerNumber--;
    8670      return;
    8771    }
    8872  }
    89 
    90   PRINTF(2)("Could not remove client from the list, very strange...");
    9173}
    92 
    93 /**
    94  * removes a proxy server
    95  */
    96 void NetworkMonitor::removeProxyServer(PeerInfo* node)
    97 {
    98   std::list<PeerInfo*>::iterator it = this->proxyServerList.begin();
    99   for(; it != this->proxyServerList.end(); it++)
    100   {
    101     if( *it == node)
    102     {
    103       this->proxyServerList.erase(it);
    104       this->playerNumber--;
    105       return;
    106     }
    107   }
    108 
    109   PRINTF(2)("Could not remove proxy server from the list, very strange...");
    110 }
    111 
    112 /**
    113  * removes a master server
    114  */
    115 void NetworkMonitor::removeMasterServer(PeerInfo* node)
    116 {
    117   std::list<PeerInfo*>::iterator it = this->masterServerList.begin();
    118   for(; it != this->masterServerList.end(); it++)
    119   {
    120     if( *it == node)
    121     {
    122       this->masterServerList.erase(it);
    123       this->playerNumber--;
    124       return;
    125     }
    126   }
    127 
    128   PRINTF(2)("Could not remove client from the list, very strange...");
    129 }
    130 
    13174
    13275
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9276 r9277  
    2828    virtual ~NetworkMonitor();
    2929
     30    /* client/masterserver/proxyserver addition/removal interface */
     31    void addNetworkNode(NetworkNode* node);
     32    void removeNetworkNode(NetworkNode* node);
    3033
    3134    void addClient(PeerInfo* node);
     
    3740    void removeMasterServer(PeerInfo* node);
    3841
     42
    3943    void showGUI();
    4044    void hideGUI();
     
    4448
    4549  private:
    46     std::list<PeerInfo*>         clientList;                   //!< list of all clients in the network
    47     std::list<PeerInfo*>         proxyServerList;              //!< list of all proxy servers in the network
    48     std::list<PeerInfo*>         masterServerList;             //!< list of all master servers in the network (should be 1!! :D)
    49 
     50    std::list<NetworkNode*>      nodeList;                   //!< list of all network nodes
    5051
    5152    OrxGui::GLGuiBox*            box;
  • branches/proxy/src/lib/network/monitor/network_node.cc

    r9276 r9277  
    1717
    1818
     19#include "debug.h"
    1920
     21
     22/**
     23 * constructor
     24 */
    2025NetworkNode::NetworkNode()
     26{
     27  this->playerNumber = 0;
     28  this->nodeType = NET_CLIENT;
     29}
     30
     31
     32/**
     33 * deconstructor
     34 */
     35NetworkNode::~NetworkNode()
    2136{}
    2237
    2338
    24 NetworkNode::~NetworkNode()
    25 {}
     39/**
     40 * adds a client
     41 */
     42void NetworkNode::addClient(PeerInfo* node)
     43{
     44  this->clientList.push_back(node);
     45  this->playerNumber++;
     46}
    2647
     48/**
     49 * adds a proxy server
     50 */
     51void NetworkNode::addProxyServer(PeerInfo* node)
     52{
     53  this->proxyServerList.push_back(node);
     54  this->playerNumber++;
     55}
     56
     57/**
     58 * adds a master server
     59 */
     60void NetworkNode::addMasterServer(PeerInfo* node)
     61{
     62  this->masterServerList.push_back(node);
     63  this->playerNumber++;
     64}
     65
     66/**
     67 * removes a client
     68 */
     69void NetworkNode::removeClient(PeerInfo* node)
     70{
     71  std::list<PeerInfo*>::iterator it = this->clientList.begin();
     72  for(; it != this->clientList.end(); it++)
     73  {
     74    if( *it == node)
     75    {
     76      this->clientList.erase(it);
     77      this->playerNumber--;
     78      return;
     79    }
     80  }
     81
     82  PRINTF(2)("Could not remove client from the list, very strange...");
     83}
     84
     85/**
     86 * removes a proxy server
     87 */
     88void NetworkNode::removeProxyServer(PeerInfo* node)
     89{
     90  std::list<PeerInfo*>::iterator it = this->proxyServerList.begin();
     91  for(; it != this->proxyServerList.end(); it++)
     92  {
     93    if( *it == node)
     94    {
     95      this->proxyServerList.erase(it);
     96      this->playerNumber--;
     97      return;
     98    }
     99  }
     100
     101  PRINTF(2)("Could not remove proxy server from the list, very strange...");
     102}
     103
     104/**
     105 * removes a master server
     106 */
     107void NetworkNode::removeMasterServer(PeerInfo* node)
     108{
     109  std::list<PeerInfo*>::iterator it = this->masterServerList.begin();
     110  for(; it != this->masterServerList.end(); it++)
     111  {
     112    if( *it == node)
     113    {
     114      this->masterServerList.erase(it);
     115      this->playerNumber--;
     116      return;
     117    }
     118  }
     119
     120  PRINTF(2)("Could not remove client from the list, very strange...");
     121}
  • branches/proxy/src/lib/network/monitor/network_node.h

    r9276 r9277  
    2222
    2323
     24    void addClient(PeerInfo* node);
     25    void addProxyServer(PeerInfo* node);
     26    void addMasterServer(PeerInfo* node);
     27
     28    void removeClient(PeerInfo* node);
     29    void removeProxyServer(PeerInfo* node);
     30    void removeMasterServer(PeerInfo* node);
     31
     32
     33
    2434  private:
    2535    int                          nodeType;                     //!< the type of the node
     36    int                          playerNumber;                 //!< localy direct connected player number
    2637
     38    /* network nodes directly connected to this node */
    2739    std::list<PeerInfo*>         clientList;                   //!< list of all clients in the network
    2840    std::list<PeerInfo*>         proxyServerList;              //!< list of all proxy servers in the network
Note: See TracChangeset for help on using the changeset viewer.