summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-01 22:25:27 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-03-09 13:48:55 +0100
commit8f134adb6dab3ad171f34a2e08a314e591380def (patch)
tree95ec403c13d7c73a013fbea4e12490d9fa6d21bd
parentMoved firework handler to separate function (diff)
downloadcuberite-8f134adb6dab3ad171f34a2e08a314e591380def.tar
cuberite-8f134adb6dab3ad171f34a2e08a314e591380def.tar.gz
cuberite-8f134adb6dab3ad171f34a2e08a314e591380def.tar.bz2
cuberite-8f134adb6dab3ad171f34a2e08a314e591380def.tar.lz
cuberite-8f134adb6dab3ad171f34a2e08a314e591380def.tar.xz
cuberite-8f134adb6dab3ad171f34a2e08a314e591380def.tar.zst
cuberite-8f134adb6dab3ad171f34a2e08a314e591380def.zip
-rw-r--r--src/World.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/World.cpp b/src/World.cpp
index ffb463169..8b791fa48 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2929,18 +2929,18 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul
cCSLock Lock(m_CSPlayers);
for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr)
{
- size_t LastSpace = a_Text.find_last_of(" "); //Find the position of the last space
+ size_t LastSpace = a_Text.find_last_of(" "); // Find the position of the last space
- std::string LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); //Find the last word
- std::string PlayerName ((*itr)->GetName());
- std::size_t Found = PlayerName.find(LastWord); //Try to find last word in playername
+ AString LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); // Find the last word
+ AString PlayerName ((*itr)->GetName());
+ size_t Found = PlayerName.find(LastWord); // Try to find last word in playername
- if (Found!=0)
+ if (Found == AString::npos)
{
- continue; //No match
+ continue; // No match
}
- a_Results.push_back((*itr)->GetName()); //Match!
+ a_Results.push_back(PlayerName); // Match!
}
}