Changeset 9282 in orxonox.OLD for branches/proxy/src/lib/network
- Timestamp:
- Jul 14, 2006, 12:06:30 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9281 r9282 80 80 81 81 82 void NetworkMonitor::addNode(PeerInfo* pInfo) 83 { 84 return; 85 86 if( pInfo->isClient()) 87 this->localNode->addClient(pInfo); 88 else if( pInfo->isProxyServer()) 89 this->localNode->addProxyServer(pInfo); 90 else if( pInfo->isMasterServer()) 91 this->localNode->addMasterServer(pInfo); 92 } 93 82 94 /** 83 95 * this displays the network monitor gui -
branches/proxy/src/lib/network/monitor/network_monitor.h
r9280 r9282 34 34 void removeNetworkNode(NetworkNode* node); 35 35 36 void addNode(PeerInfo* pInfo); 37 void addNode(NetworkNode* node, PeerInfo* pInfo) {} 38 39 /** adds to @param node a network node @param pInfo a new client */ 36 40 inline void addClient(NetworkNode* node, PeerInfo* pInfo) { node->addClient(pInfo); } 41 /** adds to @param node a network node @param pInfo a new proxy server */ 37 42 inline void addProxyServer(NetworkNode* node, PeerInfo* pInfo) { node->addProxyServer(pInfo); } 43 /** adds to @param node a network node @param pInfo a new master server*/ 38 44 inline void addMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->addMasterServer(pInfo); } 39 45 … … 54 60 private: 55 61 NetworkStream* networkStream; //!< reference to the one networkstream of the network 62 NetworkNode* localNode; //!< reference to the local node 56 63 std::list<NetworkNode*> nodeList; //!< list of all network nodes 57 64 -
branches/proxy/src/lib/network/network_stream.cc
r9281 r9282 79 79 this->peers[0].socket = new UdpSocket( host, port ); 80 80 this->peers[0].userId = 0; 81 this->peers[0]. isMasterServer = true;81 this->peers[0].nodeType = NET_MASTER_SERVER; 82 82 this->peers[0].connectionMonitor = new ConnectionMonitor( 0 ); 83 83 } … … 306 306 peers[clientId].handshake->setUniqueID(clientId); 307 307 peers[clientId].userId = clientId; 308 peers[clientId]. isMasterServer = false;308 peers[clientId].nodeType = NET_CLIENT; 309 309 } 310 310 else … … 321 321 peers[clientId].connectionMonitor = new ConnectionMonitor( clientId ); 322 322 peers[clientId].userId = clientId; 323 peers[clientId]. isMasterServer = false;323 peers[clientId].nodeType = NET_CLIENT; 324 324 325 325 PRINTF(0)("num sync: %d\n", synchronizeables.size()); … … 454 454 // PRINTF(0)("remote host is a %i\n", it->second.handshake->getRemoteNodeType()); 455 455 it->second.nodeType = it->second.handshake->getRemoteNodeType(); 456 this->networkMonitor->addNode(&it->second); 456 457 457 458 this->networkGameManager = NetworkGameManager::getInstance(); … … 719 720 } 720 721 721 if ( !peers[peer->second.userId].isMasterServer )722 if ( !peers[peer->second.userId].isMasterServer() ) 722 723 { 723 724 offset += syncDataLength; -
branches/proxy/src/lib/network/network_stream.h
r9275 r9282 56 56 /* functions for the peerInfo information retreival */ 57 57 inline bool isUserIdActive( int userID ) { return (peers.find(userID) != peers.end()); } 58 inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer ; }59 inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer ; }60 inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient ; }58 inline bool isUserMasterServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isMasterServer(); } 59 inline bool isUserProxyServer( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isProxyServer(); } 60 inline bool isUserClient( int userID ){ if ( !isUserIdActive(userID) ) return false; return peers[userID].isClient(); } 61 61 62 62 -
branches/proxy/src/lib/network/peer_info.cc
r9252 r9282 44 44 this->userId = 0; 45 45 this->nodeType = NET_CLIENT; 46 this->isMasterServer = false;47 this->isProxyServer = false;48 this->isClient = false;49 46 this->socket = NULL; 50 47 this->handshake = NULL; -
branches/proxy/src/lib/network/peer_info.h
r9275 r9282 21 21 22 22 23 inline bool isMasterServer() { return this->nodeType == NET_MASTER_SERVER; } 24 inline bool isProxyServer() { return this->nodeType == NET_PROXY_SERVER; } 25 inline bool isClient() { return this->nodeType == NET_CLIENT; } 26 27 23 28 public: 24 29 int userId; 25 30 int nodeType; 26 bool isMasterServer;27 bool isProxyServer;28 bool isClient;31 // bool isMasterServer; 32 // bool isProxyServer; 33 // bool isClient; 29 34 NetworkSocket * socket; 30 35 Handshake * handshake;
Note: See TracChangeset
for help on using the changeset viewer.