summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-18 01:33:14 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-18 01:33:14 +0200
commit679085b520f32e898a88823b1c2d23a12a1764f1 (patch)
tree2d5b67b26e5fff7f27e40734ebc368f0e07088d0 /source/World.cpp
parentAnother compile fix (diff)
downloadcuberite-679085b520f32e898a88823b1c2d23a12a1764f1.tar
cuberite-679085b520f32e898a88823b1c2d23a12a1764f1.tar.gz
cuberite-679085b520f32e898a88823b1c2d23a12a1764f1.tar.bz2
cuberite-679085b520f32e898a88823b1c2d23a12a1764f1.tar.lz
cuberite-679085b520f32e898a88823b1c2d23a12a1764f1.tar.xz
cuberite-679085b520f32e898a88823b1c2d23a12a1764f1.tar.zst
cuberite-679085b520f32e898a88823b1c2d23a12a1764f1.zip
Diffstat (limited to '')
-rw-r--r--source/World.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 702e94b56..5c15a3965 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2635,12 +2635,19 @@ 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)
{
- if (NoCaseCompare((*itr)->GetName().substr(0, a_Text.length()), a_Text) != 0)
+ for (unsigned int selected = 0; selected < a_Text.length(); selected++ )
{
- // Player name doesn't match
- continue;
+ 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;
}
- a_Results.push_back((*itr)->GetName());
}
}