diff options
author | madmaxoft <github@xoft.cz> | 2013-08-01 09:36:33 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-01 09:36:33 +0200 |
commit | 3683601b8b64dae567f90966813ec3b7c2aff2c9 (patch) | |
tree | 03922709926f36a03f6d89e3ac0be6c72020e5f0 /source/Protocol/Protocol132.cpp | |
parent | Merged in the latest core changes. (diff) | |
parent | ProtoProxy: Tab completion logging lists the last item, too (diff) | |
download | cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.tar cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.tar.gz cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.tar.bz2 cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.tar.lz cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.tar.xz cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.tar.zst cuberite-3683601b8b64dae567f90966813ec3b7c2aff2c9.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Protocol/Protocol132.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/source/Protocol/Protocol132.cpp b/source/Protocol/Protocol132.cpp index 9a985ec1f..7a3975537 100644 --- a/source/Protocol/Protocol132.cpp +++ b/source/Protocol/Protocol132.cpp @@ -70,6 +70,7 @@ enum PACKET_BLOCK_BREAK_ANIM = 0x37, PACKET_SOUND_EFFECT = 0x3e, PACKET_SOUND_PARTICLE_EFFECT = 0x3d, + PACKET_TAB_COMPLETION = 0xcb, PACKET_LOCALE_VIEW_DISTANCE = 0xcc, PACKET_CLIENT_STATUSES = 0xcd, PACKET_ENCRYPTION_KEY_RESP = 0xfc, @@ -426,6 +427,31 @@ void cProtocol132::SendSpawnMob(const cMonster & a_Mob) +void cProtocol132::SendTabCompletionResults(const AStringVector & a_Results) +{ + if (a_Results.empty()) + { + // No results to send + return; + } + + AString Serialized(a_Results[0]); + for (AStringVector::const_iterator itr = a_Results.begin() + 1, end = a_Results.end(); itr != end; ++itr) + { + Serialized.push_back(0); + Serialized.append(*itr); + } // for itr - a_Results[] + + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_TAB_COMPLETION); + WriteString(Serialized); + Flush(); +} + + + + + void cProtocol132::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) { // Not used in 1.3.2 @@ -484,9 +510,10 @@ int cProtocol132::ParsePacket(unsigned char a_PacketType) switch (a_PacketType) { default: return super::ParsePacket(a_PacketType); // off-load previously known packets into cProtocol125 - case PACKET_LOCALE_VIEW_DISTANCE: return ParseLocaleViewDistance(); case PACKET_CLIENT_STATUSES: return ParseClientStatuses(); case PACKET_ENCRYPTION_KEY_RESP: return ParseEncryptionKeyResponse(); + case PACKET_LOCALE_VIEW_DISTANCE: return ParseLocaleViewDistance(); + case PACKET_TAB_COMPLETION: return ParseTabCompletion(); } } @@ -632,6 +659,17 @@ int cProtocol132::ParsePlayerAbilities(void) +int cProtocol132::ParseTabCompletion(void) +{ + HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Text); + m_Client->HandleTabCompletion(Text); + return PARSE_OK; +} + + + + + void cProtocol132::SendData(const char * a_Data, int a_Size) { m_DataToSend.append(a_Data, a_Size); |