- Timestamp:
- Apr 21, 2011, 4:01:44 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver2/src/libraries/network/ServerList.cc
r8203 r8280 82 82 } 83 83 84 /* SEARCHING */ 85 ServerListSearchResult 86 ServerList::findServerByAddress( std::string address ) 87 { 88 /* get an iterator */ 89 std::list<ServerListElem>::iterator i; 84 90 91 /* loop through list elements */ 92 for( i = serverlist.begin(); i != serverlist.end(); ++i ) 93 if( (*i).ServerInfo.getServerIP() == address ) 94 { /* found the target, return it */ 95 ServerListSearchResult res = { (*i), true }; 96 return res; 97 } 98 99 /* no success */ 100 ServerListSearchResult res = { (*i), false }; 101 return res; 102 } 103 104 ServerListSearchResult 105 ServerList::findServerByName( std::string name ) 106 { 107 /* get an iterator */ 108 std::list<ServerListElem>::iterator i; 109 110 /* iterate, return when name found */ 111 /* loop through list elements */ 112 for( i = serverlist.begin(); i != serverlist.end(); ++i ) 113 if( (*i).ServerInfo.getServerName() == name ) 114 { 115 ServerListSearchResult res = { (*i), true }; 116 return res; 117 } 118 119 /* no luck, return a struct that tells the caller so */ 120 ServerListSearchResult res = { (*i), false }; 121 return res; 122 } 123 124 /* SORTING */ 85 125 /* sort by name */ 86 126 bool sub_compare_names( ServerListElem no1,
Note: See TracChangeset
for help on using the changeset viewer.