| 3001 | |
| 3002 | |
| 3003 | void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Results) |
| 3004 | { |
| 3005 | cCSLock Lock(m_CSPlayers); |
| 3006 | for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr) |
| 3007 | { |
| 3008 | size_t LastSpace = a_Text.find_last_of(" "); // Find the position of the last space |
| 3009 | |
| 3010 | AString LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); // Find the last word |
| 3011 | AString PlayerName ((*itr)->GetName()); |
| 3012 | size_t Found = PlayerName.find(LastWord); // Try to find last word in playername |
| 3013 | |
| 3014 | if (Found == AString::npos) |
| 3015 | { |
| 3016 | continue; // No match |
| 3017 | } |
| 3018 | |
| 3019 | a_Results.push_back(PlayerName); // Match! |
| 3020 | } |
| 3021 | } |
| 3022 | |
| 3023 | |
| 3024 |
no test coverage detected