diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-08 14:37:10 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-12-08 14:37:10 +0100 |
commit | f64dd786aadc4fafc4e7b771fe50b7c6ae95ccad (patch) | |
tree | 2e55f6b883c34590a81fca514d293cfe1823ec3c /src | |
parent | Fixed falling block metas, fixes #406 (diff) | |
download | cuberite-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 '')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 12 |
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); } |