summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-07-31 11:16:11 +0200
committermadmaxoft <github@xoft.cz>2013-07-31 11:16:11 +0200
commite8a907d89e37bf6eeab8e852c8439ae4899cd114 (patch)
treeb32238a03ec0826d2ffc02da946ea5c12fac3e71 /source/World.cpp
parentTab completion packet is handled and sent. (diff)
downloadcuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.gz
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.bz2
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.lz
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.xz
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.tar.zst
cuberite-e8a907d89e37bf6eeab8e852c8439ae4899cd114.zip
Diffstat (limited to 'source/World.cpp')
-rw-r--r--source/World.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/World.cpp b/source/World.cpp
index da29565cb..880f6e5b2 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2366,12 +2366,16 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityTy
void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Results)
{
- // TODO
- // DEBUG:
- LOGWARNING("%s: Not implemented yet!", __FUNCTION__);
- a_Results.push_back(a_Text + "_world1");
- a_Results.push_back(a_Text + "_world3");
- a_Results.push_back(a_Text + "_world2");
+ 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)
+ {
+ // Player name doesn't match
+ continue;
+ }
+ a_Results.push_back((*itr)->GetName());
+ }
}