Changeset 9589 in orxonox.OLD for branches/proxy/src/lib
- Timestamp:
- Jul 28, 2006, 11:32:05 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9586 r9589 227 227 228 228 /** 229 * @param userId of the searched node 230 * @returns the PeerInfo of the userId peer 231 */ 232 PeerInfo* NetworkMonitor::getPeerByUserId( int userId) 233 { 234 PeerInfo* pInfo; 235 std::list<NetworkNode*>::iterator it = this->nodeList.begin(); 236 for(; it != this->nodeList.end(); it++) 237 { 238 pInfo = (*it)->getPeerByUserId(userId); 239 if( pInfo != NULL) 240 return pInfo; 241 } 242 return NULL; 243 } 244 245 /** 246 * searches for a given NetworkNode 247 * @param userId of the searched node 248 * @returns the PeerInfo of the userId peer 249 */ 250 NetworkNode* NetworkMonitor::getNodeByUserId( int userId) 251 { 252 std::list<NetworkNode*>::iterator it = this->nodeList.begin(); 253 for(; it != this->nodeList.end(); it++) 254 { 255 if( (*it)->getPeerInfo()->userId == userId) 256 return (*it); 257 } 258 return NULL; 259 } 260 261 262 /** 229 263 * this displays the network monitor gui 230 264 */ -
branches/proxy/src/lib/network/monitor/network_monitor.h
r9586 r9589 79 79 80 80 inline const std::list<NetworkNode*>& getNodeList() const { return this->nodeList; }; 81 /** @param userId of the searched node @returns the PeerInfo of the userId peer */82 inline PeerInfo* getPeerByUserId( int userId) { return this->localNode->getPeerByUserId(userId); }81 PeerInfo* getPeerByUserId( int userId); 82 NetworkNode* getNodeByUserId( int userId); 83 83 84 84 -
branches/proxy/src/lib/network/proxy/proxy_control.cc
r9586 r9589 130 130 // register the new node at the network monitor 131 131 NetworkMonitor* netMon = SharedNetworkData::getInstance()->getNetworkMonitor(); 132 NetworkNode* nNode = netMon->getNodeByUserId(senderId); // this gets the proxy server who sent the msg 132 133 PeerInfo* pInfo = new PeerInfo(); 133 134 pInfo->bLocal = false; … … 135 136 pInfo->nodeType = NET_CLIENT; 136 137 pInfo->userId = newClientId; 137 netMon->addNode( pInfo);138 netMon->addNode(nNode, pInfo); 138 139 139 140 PRINTF(0)("Got Signal: from %i new player arrived with userId: %i and ip: %i\n", senderId, newClientId, pInfo->ip.ipString().c_str()); … … 193 194 // remove the node from the network monitor 194 195 NetworkMonitor* netMon = SharedNetworkData::getInstance()->getNetworkMonitor(); 195 netMon->removeNode( netMon->getPeerByUserId(leaveClientId)); 196 NetworkNode* nNode = netMon->getNodeByUserId(senderId); // this gets the proxy server who sent the msg 197 netMon->removeNode(nNode, netMon->getPeerByUserId(leaveClientId)); 196 198 197 199 PRINTF(0)("Got Signal: from %i new player left with userId: %i\n", senderId, leaveClientId);
Note: See TracChangeset
for help on using the changeset viewer.