Changeset 9445 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 25, 2006, 8:24:21 AM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_monitor.cc
r9439 r9445 179 179 * @returns the proxy server of the first choice 180 180 */ 181 PeerInfo* NetworkMonitor::getFirstChoiceProxy() 181 PeerInfo* NetworkMonitor::getFirstChoiceProxy() const 182 182 { 183 183 // return the fist proxy in the list … … 189 189 * @returns the proxy server of second choice 190 190 */ 191 PeerInfo* NetworkMonitor::getSecondChoiceProxy() 191 PeerInfo* NetworkMonitor::getSecondChoiceProxy() const 192 192 { 193 193 // return the second server in the list -
branches/proxy/src/lib/network/monitor/network_monitor.h
r9442 r9445 55 55 inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); } 56 56 57 PeerInfo* getFirstChoiceProxy() ;58 PeerInfo* getSecondChoiceProxy() ;57 PeerInfo* getFirstChoiceProxy() const; 58 PeerInfo* getSecondChoiceProxy() const; 59 59 /** @returns the local node */ 60 60 inline NetworkNode* getLocalNode() const { return this->localNode; }; 61 61 62 62 /** @returns the active proxy server list of the localnode */ 63 inline std::list<PeerInfo*> getActiveProxyServer() { return this->localNode->getActiveProxyServer(); }63 inline std::list<PeerInfo*> getActiveProxyServer() const { return this->localNode->getActiveProxyServer(); } 64 64 65 65 /* slots admin and info interface */ 66 66 /** @returns the total number of players in this game (including all proxy servers etc)*/ 67 inline int getPlayerNumber() { return this->playerNumber; }67 inline int getPlayerNumber() const { return this->playerNumber; } 68 68 69 69 /** @returns true if there are still free network slots available at the local node*/ 70 inline bool gotFreeSlots() { return (this->localNode->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }70 inline bool gotFreeSlots() const { return (this->localNode->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer()); } 71 71 /** @param node node to be checked for slots @returns true if there are still free network slots available at this node */ 72 inline bool gotFreeSlots(NetworkNode* node) { return (node->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }72 inline bool gotFreeSlots(NetworkNode* node) const { return (node->getPlayerNumber() < SharedNetworkData::getInstance()->getMaxPlayer()); } 73 73 74 74 /** @returns true if the next client should be reconnected to some other proxy server with more connections */ 75 inline bool isReconnectNextClient() { return (this->localNode->getPlayerNumber() >= SharedNetworkData::getInstance()->getMaxPlayer())?true:false; }75 inline bool isReconnectNextClient() const { return (this->localNode->getPlayerNumber() >= SharedNetworkData::getInstance()->getMaxPlayer()); } 76 76 77 inline const std::list<NetworkNode*>& getNodeList() const { return this->nodeList; }; 77 78 78 79 void toggleGUI(); -
branches/proxy/src/lib/network/peer_info.cc
r9444 r9445 54 54 55 55 56 const std::string& PeerInfo::getNodeTypeString() 56 const std::string& PeerInfo::getNodeTypeString() const 57 57 { 58 return nodeNames[this->nodeType]; 58 return PeerInfo::nodeTypeToString( this->nodeType ); 59 // the above does the same, and is faster in it. (there is no case where node is uninit i hope!) 59 60 /* 60 61 switch( this->nodeType) … … 73 74 } 74 75 76 const std::string& PeerInfo::nodeTypeToString(unsigned int type) 77 { 78 return PeerInfo::nodeNames[type]; 79 } 80 81 75 82 const std::string PeerInfo::nodeNames[] = 76 83 { -
branches/proxy/src/lib/network/peer_info.h
r9444 r9445 27 27 inline bool isClient() const { return this->nodeType == NET_CLIENT; } 28 28 29 const std::string& getNodeTypeString(); 29 const std::string& getNodeTypeString() const; 30 static const std::string& nodeTypeToString(unsigned int type); 30 31 31 32
Note: See TracChangeset
for help on using the changeset viewer.