Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9445 in orxonox.OLD


Ignore:
Timestamp:
Jul 25, 2006, 8:24:21 AM (18 years ago)
Author:
bensch
Message:

some more const's

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

Legend:

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

    r9439 r9445  
    179179 * @returns the proxy server of the first choice
    180180 */
    181 PeerInfo* NetworkMonitor::getFirstChoiceProxy()
     181PeerInfo* NetworkMonitor::getFirstChoiceProxy() const
    182182{
    183183  // return the fist proxy in the list
     
    189189 * @returns the proxy server of second choice
    190190 */
    191 PeerInfo* NetworkMonitor::getSecondChoiceProxy()
     191PeerInfo* NetworkMonitor::getSecondChoiceProxy() const
    192192{
    193193  // return the second server in the list
  • branches/proxy/src/lib/network/monitor/network_monitor.h

    r9442 r9445  
    5555    inline void removeMasterServer(NetworkNode* node, PeerInfo* pInfo) { node->removeMasterServer(pInfo); }
    5656
    57     PeerInfo* getFirstChoiceProxy();
    58     PeerInfo* getSecondChoiceProxy();
     57    PeerInfo* getFirstChoiceProxy() const;
     58    PeerInfo* getSecondChoiceProxy() const;
    5959    /** @returns the local node */
    6060    inline NetworkNode* getLocalNode() const { return this->localNode; };
    6161
    6262    /** @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(); }
    6464
    6565    /* slots admin and info interface */
    6666    /** @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; }
    6868
    6969    /** @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()); }
    7171    /** @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()); }
    7373
    7474    /** @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()); }
    7676
     77    inline const std::list<NetworkNode*>& getNodeList() const { return this->nodeList; };
    7778
    7879    void toggleGUI();
  • branches/proxy/src/lib/network/peer_info.cc

    r9444 r9445  
    5454
    5555
    56 const std::string& PeerInfo::getNodeTypeString()
     56const std::string& PeerInfo::getNodeTypeString() const
    5757{
    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!)
    5960/*
    6061  switch( this->nodeType)
     
    7374}
    7475
     76const std::string& PeerInfo::nodeTypeToString(unsigned int type)
     77{
     78  return PeerInfo::nodeNames[type];
     79}
     80
     81
    7582const std::string PeerInfo::nodeNames[] =
    7683{
  • branches/proxy/src/lib/network/peer_info.h

    r9444 r9445  
    2727    inline bool isClient() const { return this->nodeType == NET_CLIENT; }
    2828
    29     const std::string& getNodeTypeString();
     29    const std::string& getNodeTypeString() const;
     30    static const std::string& nodeTypeToString(unsigned int type);
    3031
    3132
Note: See TracChangeset for help on using the changeset viewer.