summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol17x.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-08 14:37:10 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-12-08 14:37:10 +0100
commitf64dd786aadc4fafc4e7b771fe50b7c6ae95ccad (patch)
tree2e55f6b883c34590a81fca514d293cfe1823ec3c /src/Protocol/Protocol17x.cpp
parentFixed falling block metas, fixes #406 (diff)
downloadcuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.tar
cuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.tar.gz
cuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.tar.bz2
cuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.tar.lz
cuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.tar.xz
cuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.tar.zst
cuberite-f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad.zip
Diffstat (limited to 'src/Protocol/Protocol17x.cpp')
-rw-r--r--src/Protocol/Protocol17x.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 233155c90..75983e9a3 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -744,17 +744,13 @@ void cProtocol172::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp
void cProtocol172::SendTabCompletionResults(const AStringVector & a_Results)
{
- AString Results;
- Results.reserve(500); // Make a moderate reservation to avoid excessive reallocations
+ cPacketizer Pkt(*this, 0x3a); // Tab-Complete packet
+ Pkt.WriteVarInt(a_Results.size());
+
for (AStringVector::const_iterator itr = a_Results.begin(), end = a_Results.end(); itr != end; ++itr)
{
- Results.append(*itr);
- Results.push_back(0);
+ Pkt.WriteString(*itr);
}
-
- cPacketizer Pkt(*this, 0x3a); // Tab-Complete packet
- Pkt.WriteVarInt(a_Results.size());
- Pkt.WriteString(Results);
}