summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-18 12:58:19 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-18 12:58:19 +0200
commit9e0b8b5bee6fec15df846334cffc2d8e913c0328 (patch)
treebab0c58d34046bc67e55ef1b6071aed295921bad /source/World.cpp
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadcuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.tar
cuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.tar.gz
cuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.tar.bz2
cuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.tar.lz
cuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.tar.xz
cuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.tar.zst
cuberite-9e0b8b5bee6fec15df846334cffc2d8e913c0328.zip
Diffstat (limited to '')
-rw-r--r--source/World.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 5c15a3965..6b82dce0f 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2635,19 +2635,15 @@ 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)
{
- for (unsigned int selected = 0; selected < a_Text.length(); selected++ )
+ unsigned LastSpace = a_Text.find_last_of(" ");
+ std::string LastWord = a_Text.substr(LastSpace + 1, a_Text.length());
+ std::string PlayerName ((*itr)->GetName());
+ std::size_t Found = PlayerName.find(LastWord);
+ if (Found!=0)
{
- std::string playername ((*itr)->GetName());
- std::string cut (a_Text.substr(selected, a_Text.length()));
- std::size_t found = playername.find(cut);
- if (found!=0)
- {
- //Player name doesn't match
- continue;
- }
- a_Results.push_back((*itr)->GetName());
- break;
+ continue;
}
+ a_Results.push_back((*itr)->GetName());
}
}